Работает данный скрипт с любым IPB версией , и так же с любым CMS .... Пользуйтесь на здоровье!!
1. Первое: Создаем файл с названием
latest_posts.php и вставляем туда это:
<?
// ******************************************* //
// Создатель оригинального мода Charli007. //
// ******************************************* //
$posts = 10;
$showtopiclength = 1;
$topiclength = 40;
$forumexclude = "10,13,15";
$datedisplay = 'd F Y';
$timedisplay = 'h:i A T';
require "ips_kernel/class_db_mysql.php";
require "conf_global.php";
$db = new db_driver;
$db->obj['sql_database'] = $INFO['sql_database'];
$db->obj['sql_user'] = $INFO['sql_user'];
$db->obj['sql_pass'] = $INFO['sql_pass'];
$db->obj['sql_host'] = $INFO['sql_host'];
$db->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix'];
$db->connect();
$getposts = $db->query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics WHERE (forum_id NOT IN ($forumexclude)) ORDER BY last_post DESC LIMIT $posts");
while ($post = $db->fetch_row($getposts)) {
$post[full_title] = $post[title];
if ($showtopiclength == 1 AND strlen($post[full_title]) > $topiclength) {
$post[short_title] = substr($post[full_title],0,$topiclength);
$post[short_title] = $post[short_title]."...";
}
else {
$post[short_title] = $post[full_title];
}
$posted_on = date($datedisplay, $post[last_post]);
$today_date = date($datedisplay, time());
If ($posted_on == $today_date) {
$datefield = "Сегодня";
$datefield = $datefield . ", " . date($timedisplay, $post[last_post]);
}
elseif (date('d F Y',strtotime("-1 day")) == $posted_on) {
$datefield = "Вчера";
$datefield = $datefield . ", " . date($timedisplay, $post[last_post]);
}
else {
$datefield = $today_date;
}
echo
<<<EOD
<a href="$INFO[board_url]/index.php?showtopic=$post[tid]&view=getnewpost">$post[short_title]</a> by
<a href="$INFO[board_url]/index.php?showuser=$post[last_poster_id]">$post[last_poster_name]</a> <BR>
$datefield, и $post[posts] ответов.<P>
EOD;
}
?>
Кидаем данный файлик в директорию форума!
2. Создаем ещё один файлик с наименованием
latestposts.php вкладываем в него это:
<? if (!eregi("index.php", $PHP_SELF)) { die ("<center><font face="Tahoma" color="red" size="9pt"><b>ACCESS DENIED!</b></font></center>"); } ?>
<table id="BLOCK_RIGHT" width="202" height="69" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/bl2_01.gif" width="3" height="1"></td>
<td>
<img src="images/bl2_02.gif" width="196" height="1"></td>
<td>
<img src="images/bl2_03.gif" width="3" height="1"></td>
</tr>
<tr>
<td>
<img src="images/bl2_04.gif" width="3" height="14"></td>
<td background="images/bl2_05.gif" class="b_text" align="center">
<!-- START TITLE -->
Форум пишет
<!-- END TITLE -->
</td>
<td>
<img src="images/bl2_06.gif" width="3" height="14"></td>
</tr>
<tr>
<td>
<img src="images/bl2_07.gif" width="3" height="4"></td>
<td>
<img src="images/bl2_08.gif" width="196" height="4"></td>
<td>
<img src="images/bl2_09.gif" width="3" height="4"></td>
</tr>
<tr>
<td background="images/bl2_10.gif">
<img src="images/bl2_10.gif" width="3" height="47"></td>
<td valign="top" background="images/bl2_11.gif">
<!-- START MSG -->
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="top" class="text">
<tr>
<td>
<?
include "http://ссылка где в дерикторию форума/latest_posts.php";
?>
</td>
</tr>
</table>
<!-- END MSG --></td>
<td background="images/bl2_12.gif">
<img src="images/bl2_12.gif" width="3" height="47"></td>
</tr>
<tr>
<td>
<img src="images/bl2_13.gif" width="3" height="3"></td>
<td>
<img src="images/bl2_14.gif" width="196" height="3"></td>
<td>
<img src="images/bl2_15.gif" width="3" height="3"></td>
</tr>
</table>
Или скачать:
Вы не можете скачивать файлы с нашего сервераПрошу не проглядеть в строке 41 в файле latest_posts.php -> include "http://ссылка где в дерикторию форума/latest_posts.php"; не забыть прописать путь к файлику в директории форума !!!
И этот файлик кидаем в директорию Портала !!!
....идем дальше....
3. И осталось только добавить выход в Блок куда вы его сами захотите вставить в файле
main.tpl :
Вставляем этот код:
<?
include "latestposts.php";
?>
4. Чтобы php работал в шаблоне делаем это
Открыть
index.phpНайти строку:
echo $tpl->result['main'];
заменить на :
eval (' ?' . '>' . $tpl->result['main'] . '<' . '?php ');