Jump to content
Sign in to follow this  

[Решено?..] Последние темы с IPB 3.x на Opencart

Recommended Posts

И так решил такую штуку сделать)))


1) Взял у вас на форуме модуль html блоки (с исполнением php)


2) Есть скрипт для вывода из бд IPB последних тем.


if(!defined("DNREAD")) exit();

//======[ОСНОВНЫЕ НАСТРОЙКИ]======
//Префикс таблицы с IPB
$prefix = 'ibf';
//Сколько тем выводить
$num = 10;
//Сколько символов оставить в названии темы после урезания
$topic_num_sym = 40;
//Имя папки с картинками текущего скина
$img_path = '1';
//Формат времени
$time = 'd.m H:i';
//Форумы, которые мы не трогаем
$forumexclude = '11,21';
//Сервер БД на котором висит база форума
//Имя БД
//Логин БД
//Пароль БД

//====[Вывод блока таблицой :)]=========

$ipb_db = mysql_pconnect($host, $username, $password) or trigger_error(mysql_error(), E_USER_ERROR);
mysql_select_db($database, $ipb_db);
$bt = "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" bgcolor=\"#dee2e5\">";
$bt.= "<th width=\"60%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Название темы</font></th>";
$bt.= "<th width=\"10%\" height=\"26\" align=\"center\"><font class=\"storytitle\"><b>Автор</b></font></th>";
$bt.= "<th width=\"5%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Ответов</font></th>";
$bt.= "<th width=\"5%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Просмотров</font></th>";
$bt.= "<th width=\"20%\" height=\"26\" align=\"center\" colspan=\"2\"><font class=\"storytitle\"><b>Последний ответ</b></font></th>";
$resultf = mysql_query("SELECT tid, title, description, state, posts, starter_id, last_poster_id, last_post, icon_id, starter_name, last_poster_name, views, topic_hasattach FROM ".$prefix."_topics WHERE (forum_id NOT IN ($forumexclude)) ORDER BY last_post DESC LIMIT $num",$ipb_db) or die(mysql_error());
$row_resultf = mysql_fetch_assoc($resultf);
$totalRows_resultf = mysql_num_rows($resultf);
do {
$topicstrip = $row_resultf['title'];
if (strlen($topicstrip) > $topic_num_sym) {
$topicstrip = substr($topicstrip,0,$topic_num_sym);
$topicstrip = $topicstrip."...";
$status = ($row_resultf['state'] == "closed") ? "<img src=\"forum/style_images/$img_path/f_closed.gif\" border=\"0\" alt=\"Тема закрыта\">" : "";
$attach = ($row_resultf['topic_hasattach'] == "1") ? "<img src=\"temp/A-Vector/images/files.gif\" border=\"0\" alt=\"В сообщении есть прикрепленные файлы\"> " : "";
$icon = ($row_resultf['icon_id'] == "0") ? " <img border=\"0\" src=\"temp/Default/images/icon.gif\">  " : "<img src=\"forum/style_images/$img_path/folder_post_icons/icon$icon_id.gif\" border=\"0\" alt=\"Иконка сообщения\"> ";
$last_date = date($time,$row_resultf['last_post']);
$bt.= "<tr>";
$bt.= "<td bgcolor=\"#FFFFFF\">";
$bt.= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\"><tr>";
$bt.= "<td>$icon</td>";
$bt.= "<td width=\"100%\"><a title=\"".$row_resultf['description']."\" href=\"forum/index.php?showtopic=".$row_resultf['tid']."&view=getlastpost\">$topicstrip</a></td>";
$bt.= "<td align=\"center\" valign=\"middle\">$attach</td>";
$bt.= "<td align=\"center\" valign=\"middle\">$status</td>";
$bt.= "</tr></table></td>";
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\"><a href=\"forum/index.php?showuser=".$row_resultf['starter_id']."\">".$row_resultf['starter_name']."</a></td>";
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">".$row_resultf['posts']."</td>";
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">".$row_resultf['views']."</td>";
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">$last_date</td>";
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\"><a href=\"forum/index.php?showuser=".$row_resultf['last_poster_id']."\">".$row_resultf['last_poster_name']."</a></td>";
$bt.= "</tr>";
} while($row_resultf = mysql_fetch_assoc($resultf));
$bt.= "</table>";
return $bt;



Получил пустую страницу белую.


Я так понимаю из коробки он не может сделать запрос к базе данных... Помогите как осилить это?

Edited by garfild305

Share this post

Link to post
Share on other sites

1) не надо так

2) и так не надо.


if(!defined("DNREAD")) exit();
и смотри.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.