В корневой каталог форума кладем файл "glance_anno_rotate.php"
Код: Выделить всё
<?php
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
$glance_anno_posts = @explode(',',str_replace(' ','',$board_config['glance_anno_post']));
$anno_post_key = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_anno']) ) ? intval($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_anno"]) : 0;
$anno_post_key++;
if ( $anno_post_key >= count($glance_anno_posts) || !$glance_anno_posts[$anno_post_key] ) $anno_post_key = 0;
setcookie($board_config['cookie_name'] . '_anno', $anno_post_key, time()+(60*60*24*30), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
$board_config['glance_anno_post'] = $glance_anno_posts[$anno_post_key];
?>
Код: Выделить всё
#
#-----[ OPEN ]---------------------------------
#
index.php
#
#-----[ FIND]-----------------
#
//
// Start output of page
//
#
#-----[ BEFORE, ADD ]-----------------
#
// [begin] Glance mod rotate AddOn
include($phpbb_root_path . 'glance_anno_rotate.'.$phpEx);
// [end] Glance mod rotate AddOn
#
#-----[ OPEN ]---------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]-----------------
# в райне 37-ой строки
<td class="row2"><input class="post" type="text" size="5" maxlength="4" name="glance_anno_post" value="{GLANCE_ANNO_POST}" /></td>
#
#-----[ REPLACE ]-----------------
#
<td class="row2"><input class="post" type="text" size="25" maxlength="24" name="glance_anno_post" value="{GLANCE_ANNO_POST}" /></td>
#
#-----[ SAVE/CLOSE ALL FILES ]-----------------
#
Добавлено спустя 46 минут 6 секунд:
Также можно добавить к объявлению дату публикации и автора:
Код: Выделить всё
#
#-----[ OPEN ]---------------------------------
#
glance.php
#
#-----[ FIND ]--------------
#
// Announcement text
if ( $glance_anno_post )
{
$sql = "SELECT * FROM " . POSTS_TEXT_TABLE . " WHERE post_id = $glance_anno_post";
$result = $db->sql_query($sql) or message_die(GENERAL_ERROR, 'Could not obtain announcement information', '', __LINE__, __FILE__, $sql);
$announcement = $db->sql_fetchrow($result);
$announcement_text = bbencode_second_pass($announcement['post_text'], $announcement['bbcode_uid']);
$announcement_text = str_replace("\n", "\n<br />\n", $announcement_text);
}
else
{
$announcement_text = '';
}
$template->assign_vars(array(
'ANNO_TITLE' => $lang['Glance_anno'],
'ANNO_TEXT' => $announcement_text,
'RECENT_TITLE' => $lang['Glance_recent'])
);
#
#-----[ REPLACE ]--------------
#
// Announcement text
if ( $glance_anno_post )
{
$sql = "SELECT t.post_id, t.post_text, t.bbcode_uid, p.post_time, p.poster_id, u.username
FROM " . POSTS_TEXT_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.post_id = $glance_anno_post
AND p.post_id = t.post_id
AND u.user_id = p.poster_id";
$result = $db->sql_query($sql) or message_die(GENERAL_ERROR, 'Could not obtain announcement information', '', __LINE__, __FILE__, $sql);
$announcement = $db->sql_fetchrow($result);
$announcement_text = bbencode_second_pass($announcement['post_text'], $announcement['bbcode_uid']);
$announcement_text = str_replace("\n", "\n<br />\n", $announcement_text);
$announcement_date = create_date($lang['DATE_FORMAT'], $announcement['post_time'], $board_config['board_timezone']);
$announcement_author = "<a href=profile.php?mode=viewprofile&u=".$announcement['poster_id'].">".$announcement['username']."</a>";
}
else
{
$announcement_text = $announcement_date = $announcement_author = '';
}
$template->assign_vars(array(
'ANNO_TITLE' => $lang['Glance_anno'],
'ANNO_TEXT' => $announcement_text,
'ANNO_DATE' => $announcement_date,
'ANNO_AUTHOR' => $announcement_author,
'RECENT_TITLE' => $lang['Glance_recent'])
);

Код: Выделить всё
#
#-----[ OPEN ]---------------------------------
#
templates/subSilver/glance_body.tpl
#
#-----[ FIND ]-------------------------
# около 5-ой строки
#
<table width="100%" cellpadding=2 cellspacing=1 border=0 class="forumline">
<tr><th colspan=2 class="thTop" height=25>{ANNO_TITLE}</th></tr>
<tr>
<td class="row1"><span class="gensmall">{ANNO_TEXT}</span></td>
</tr>
</table>
#
#-----[ REPLACE ]-----------------------
#
<table width="100%" cellpadding=2 cellspacing=1 border=0 class="forumline">
<tr><th colspan=2 class="thTop" height=25>{ANNO_TITLE}</th></tr>
<tr>
<td><span class="gensmall">{ANNO_DATE}<br />({ANNO_AUTHOR})</span></td>
<td class="row1"><span class="gensmall">{ANNO_TEXT}</span></td>
</tr>
</table>
