Ответов: 129 Просмотров: 90883
 |
Посмотрел и сразу первый вопрос - у вас этот файл раньше работал?
Просто первое, что бросилось в глаза - этот файл информацию выводит через modules/portal/portal.tpl а вы, как я понял, хотите что бы через homepage.tpl
Или предполагалось сделать вывод в зависимости от поступивших в запросе параметров?
В предварительном виде файл получился такой
Спойлер (Отобразить)CODE:<?php
define('IN_EXBB', TRUE);
include('./include/common.php');
$fm->_GetVars();
$fm->_BOARDSTATS();
// готовим данные
$onlinedata = $fm->_OnlineLog($fm->LANG['BoardMain'],FALSE,TRUE);
$countonline = ($fm->exbb['visiblemode'] === TRUE) ?
sprintf($fm->LANG['OnlineDataVSHide'],$fm->exbb['membergone'],$fm->_OnlineTotal,$fm->_OnlineGuest,$fm->_Members,$fm->_Invisible):
sprintf($fm->LANG['OnlineData'],$fm->exbb['membergone'],$fm->_OnlineTotal,$fm->_Members,$fm->_OnlineGuest);
$online_last = $countonline . ' [<span class="admin">'.$fm->LANG['Admin'].'</span>, <span class="supmoder">'.$fm->LANG['SuperModer'].'</span>,
<span class="moder">'.$fm->LANG['Moderator'].'</span> , '.$fm->LANG['User'].' ]';
$members_output = $fm->_MembersOutput;
$todayvisit = FALSE; today($todayvisit);
$maximum = sprintf($fm->LANG['MaxUsers'],$fm->_Stats['max_online']).date("d.m.Y H:i",$fm->_Stats['max_time']+$fm->user['timedif']*3600);
$homepage = $fm->_Read(FM_HOMEPAGE);
newpostst();
// выводим данные
include('./templates/'.DEF_SKIN.'/all_header.tpl');
include('./templates/'.DEF_SKIN.'/logos.tpl');
include('./templates/'.DEF_SKIN.'/modules/portal/portal.tpl'); // выводим через этот?
//include('./templates/'.DEF_SKIN.'/newposts.tpl'); // или через этот?
include('./templates/'.DEF_SKIN.'/footer.tpl');
// объявляем функции
function today(&$todayvisit)
{
global $today, $fm;
$members = $hiddens = 0;
$was = array();
if (empty($today['members'])) {$today['members'] = array();}
foreach ($today['members'] as $id => $member)
{
switch ($member['s'])
{
case 'ad': $class = ' class="admin"'; break;
case 'sm': $class = ' class="supmoder"'; break;
default: $class = '';
}
if ($member['v'])
{
if ($member['s'] != 'ad') {$hiddens++;}
if (defined('IS_ADMIN') || $id == $fm->user['id']) {$member['n'] .= '*';}
else {continue;}
}
else
{$members++;}
$was[] = '<a href="profile.php?action=show&member='.$id.'"'.$class.'>'.$member['n'].'</a>';
}
$sel_hiddens = ($hiddens) ? sprintf($fm->LANG['HiddensOnline'], $hiddens) : '';
$sel_was = ($was) ?
'<br /> '.implode(', ', $was).'' : '';
$todayvisit = sprintf($fm->LANG['TodayVisit'], $today['guests'] + $members + $hiddens, $today['guests'], $members, $sel_hiddens, $sel_was);
}
function newpostst()
{
global $fm, $pages;
$allforums = $fm->_Read(FM_ALLFORUMS);
$t_visits = $fm->_GetCookieArray('t_visits');
$allforums_keys = array_keys(array_filter($allforums, 'filterForums'));
require('modules/watches/_search.php');
if (!$fm->exbb['watches'])
{
$alltopics = array();
foreach ($allforums as $forum_id => $forum)
{
if (!defined('IS_ADMIN') && $forum['private'] === TRUE)
{if (!isset($fm->user['private'][$forum_id]) || $fm->user['private'][$forum_id] === FALSE) continue;}
if ($forum['last_time'] > $fm->user['last_visit'])
{$alltopics = array_merge($alltopics,array_filter($fm->_Read('forum'.$forum_id.'/list.php'),"SearchNewPost"));}
}
}
if (count($alltopics) !== 0)
{
usort($alltopics,"sort_by_postdate");
$t_visits = $fm->_GetCookieArray('t_visits');
global $f_readed;
$data = '';
$alltopics_keys = array_keys($alltopics);
$pages = Print_Paginator(count($alltopics_keys), 'search.php?action=newposts&p={_P_}', $fm->exbb['topics_per_page'], 8, $first, TRUE);
$alltopics_keys = array_slice($alltopics_keys, $first, $fm->exbb['topics_per_page']);
foreach ($alltopics_keys as $topic)
{
$topic = $alltopics[$topic];
$forum_id = $topic['fid'];
$topic_id = $topic['id'];
$f_readed = $fm->_GetCookie('f'.$forum_id,0);
$TopicVisitTime = (isset($t_visits[$forum_id.':'.$topic_id]) && $t_visits[$forum_id.':'.$topic_id] > $fm->user['last_visit']) ? $t_visits[$forum_id.':'.$topic_id] : $fm->user['last_visit'];
$topicicon = topic_icon($topic,$TopicVisitTime, isset($topic['watched']) ? $topic['watched'] : true);
$author = ($topic['author'] !== FALSE) ? $topic['author']:$fm->LANG['Guest'];
$author = ($topic['a_id'] !== 0) ? '<a href="profile.php?action=show&member='.$topic['a_id'].'">'.$author.'</a>' : $author;
$poster = ($topic['poster'] !== FALSE) ? $topic['poster'] : $fm->LANG['Guest'];
$poster = ($topic['p_id'] !== 0) ? '<a href="profile.php?action=show&member='.$topic['p_id'].'">'.$poster.'</a>' : $poster;
$pretopicname = ($fm->exbb['watches'] && (!isset($topic['watched']) || $topic['watched']) || !$fm->exbb['watches'] && $fm->user['last_visit'] < $topic['postdate'] && $fm->user['id'] != $topic['p_id'] && $TopicVisitTime < $topic['postdate'])
? '<a href="topic.php?forum='.$forum_id.'&topic='.$topic_id.'&v=u#unread" title="'.$fm->LANG['GoToFirstUnread'].'"><img src="./templates/'.DEF_SKIN.'/im/unread.gif" border="0" /></a> ' : '';
$topicname = $pretopicname . '<a href="topic.php?forum='.$forum_id.'&topic='.$topic_id.'&v=l#'.$topic['postkey'].'">'.$fm->chunk_split($topic['name']).'</a>';
$topicdesc = $fm->chunk_split($topic['desc']);
$forumname = '<a href="forums.php?forum='.$forum_id.'">'.$allforums[$forum_id]['name'].'</a>';
$posts = $topic['posts'];
$postdate = $fm->_DateFormat($topic['postdate']+$fm->user['timedif']*3600);
$data .= <<<DATA
<tr>
<td align="center" class="row4">{$topicicon}</td>
<td class="row4"><b>{$topicname}</b><br>{$topicdesc}</td>
<td align="center" class="row2">{$forumname}</td>
<td align="center" class="row2">
{$fm->LANG['Replies']}: <b>{$posts}</b>
<br>
{$fm->LANG['TopicAuthor']}: <b>{$author}</b></td>
<td class="row2">
<span class="desc">
{$postdate}
<br>
{$fm->LANG['Author']}: <b>{$poster}</b>
</span>
</td>
</tr>
DATA;
}
$found = count($alltopics);
$fm->_Title = ' :: '.$fm->LANG['NewPosts'];
$searchinmessage = '';
}
else
{$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['NoNewPosts']);}
}
function filterForums($forum)
{
global $fm;
if (!defined('IS_ADMIN') && $forum['private'] && empty($fm->user['private'][$forum['id']]))
{return false;}
return true;
}
function SearchNewPost($var)
{
global $fm;
if ($var === 'moved') {return 0;}
else
{return ($var['postdate'] > $fm->user['last_visit'] && $var['p_id'] != $fm->user['id']) ?1:0;}
}
?>
Данные находятся в переменной $data, которfz представляет из себя внутренний каркас таблицы (данные заключены в теги <tr><td></td></tr> ) , т.е. эту переменную вставляем внутрь таблицы. Для примера - смотрите newposts.tpl |