XANDER-CAGE
Пользователь
Автор: Frost444
TP-II: XANDER-CAGE
CSS: Pherum
Описание: Вывод последних сообщений
Скрин:
http://s017.*******.host/i417/1111/47/3c30ff073d35.png
[build_cat_forums.php]
[index.php]
[config.php]
[common.php]
#######TPL#######
page_header.tpl
[main.css]
[lang_main.php]
TP-II: XANDER-CAGE
CSS: Pherum
Описание: Вывод последних сообщений
Скрин:
http://s017.*******.host/i417/1111/47/3c30ff073d35.png
[build_cat_forums.php]
PHP:
// last added post
if($bb_cfg['new_add_post_num'])
{
$trash_forums = $bb_cfg['trash_forum_id'] ? $bb_cfg['trash_forum_id'] : '0';
$ignor_forum = $bb_cfg['new_add_post_ignor_f'];
$data = DB()->fetch_rowset("SELECT
tr.topic_id, tr.forum_id, tr.poster_id,
t.*, f.*, u.user_id, u.username, u.user_avatar, u.user_avatar_type, u.user_opt
FROM
". BB_POSTS ." tr
LEFT JOIN ". BB_TOPICS ." t ON tr.post_id = t.topic_last_post_id
AND t.forum_id NOT IN($ignor_forum, $trash_forums)
LEFT JOIN ". BB_FORUMS ." f ON tr.forum_id = f.forum_id
AND f.auth_read = ". AUTH_ALL ."
LEFT JOIN ". BB_USERS ." u ON tr.poster_id = u.user_id
ORDER BY
t.topic_last_post_time DESC
LIMIT 0,".$bb_cfg['new_add_post_num']);
$this->store('new_added_post', $data);
}
[index.php]
PHP:
//Last added post
if($bb_cfg['new_add_post_num'])
{
$new_added_post = $datastore->get('new_added_post');
foreach ($new_added_post as $new_post)
{
$template -> assign_block_vars('newaddpost',array(
'TOPIC_TITLE' => $new_post['topic_title'],
'TOPIC_ID' => $new_post['topic_id'],
'NEW_P_CLASS' => (is_unread($new_post['topic_last_post_time'], $new_post['topic_id'], $new_post['forum_id'])) ? $bb_cfg['new_add_post_col'] : '',
'AUTOR_POST' => $new_post['username'],
'AUTOR_AVATAR' => get_avatar($new_post['user_avatar'], $new_post['user_avatar_type'], !bf($new_post['user_opt'], 'user_opt', 'allow_avatar')),
'AUTOR_POST_ID' => $new_post['user_id'],
'POST_TIME' => date('Y-m-d H:i', $new_post['topic_last_post_time']),
'URL_NEW_POST' => append_sid(BB_ROOT ."viewtopic.php?". POST_POST_URL ."=". $new_post['topic_last_post_id'] ."#". $new_post['topic_last_post_id'])
)) ;
}
}
[config.php]
PHP:
$bb_cfg['new_add_post_num'] = 5; // количество выводимых сообщений
$bb_cfg['new_add_post_ignor_f'] = 1; //Форумы которые нужно игнорировать
$bb_cfg['new_add_post_col'] = '#FAA'; //цвет нового сообщения
[common.php]
PHP:
'new_added_post' => 'build_cat_forums.php',
#######TPL#######
page_header.tpl
Код:
<div class="catnew">
<div id="new_post">
<div class="spacer_8"></div>
<h4 class="tCenter">{L_LAST_ADD_POST}</h4>
<div class="spacer_8"></div>
<div class="iComm" id="iComm"><ul>
<!-- BEGIN newaddpost -->
<a href="profile.php?mode=viewprofile&u={newaddpost.AUTOR_POST_ID}" class="avatar">
{newaddpost.AUTOR_AVATAR}
</a>
<div><a href="viewtopic.php?t={newaddpost.TOPIC_ID}" style="font-size:11px">{newaddpost.TOPIC_TITLE}</a></div>
{L_AUTHOR_NEW_POST}: <a href="profile.php?mode=viewprofile&u={newaddpost.AUTOR_POST_ID}">
{newaddpost.AUTOR_POST}</a>
{L_DATE_TIME}: {newaddpost.POST_TIME}
<hr>
<!-- END newaddpost -->
</div></div></div>
[main.css]
Код:
.catnew{
border:solid #c3cbd1;border-width:1px;padding:6px;background:#f5f5f5;border-radius:5px;-moz-border-radius:5px;box-shadow:0 0 5px #dadada;-moz-box-shadow:0 0 5px #dadada;-webkit-box-shadow:0 0 5px #dadada;
}
PHP:
$lang['LAST_ADD_POST'] = 'Последние сообщения';
$lang['AUTHOR_NEW_POST'] = 'Написал';
$lang['DATE_TIME'] = 'В';