Перейти к контенту

alkov

Пользователи
  • Число публикаций

    8
  • Регистрация

  • Последнее посещение

Недавние посетители профиля

Блок недавних посетителей отключен и не доступен другим пользователям для просмотра.

Достижения alkov

  1. По поводу отображения даты. В раздел пользовательских установок (после // Edit the following to suit your site) необходимо добавить строку: $timeoffset = "+0"; // Differance between server time and GMT (or another timezone). Alters displayed post times. Use + or - and amount of offset in hours (eg: "+6") и заменить нижеследующий код if ($scroll=="1") { $content = " <MARQUEE behavior=\"scroll\" align=\"left\" direction=\"up\" height=\"150\" width=\"100%\" scrollamount=\"1\" scrolldelay=\"10\" onmouseover='this.stop()' onmouseout='this.start()'>"; } while($ipb_result = $db->sql_fetchrow($ipb_query)) { $timestamp = $ipb_result[5]+$timeoffset*3600; $stamp = date('jS M g:i a', $timestamp); $content .= "<br><img src=\"".$ipb_image_path."\"> <b><a href=\"/".$ipb_path."?act=ST&f=".$ipb_result[4]."&t=".$ipb_result[0]."&view=getnewpost\" target=\"_blank\">".$ipb_result[1]."</a></b> <i>by "; if($ipb_result[3] != 0) {$content .= "<a href=\"".$ipb_path."?act=Profile&CODE=03&MID=".$ipb_result[3]."\" target=\"_blank\">".$ipb_result[2]."</a></i> - ".$stamp."<br>\n"; } else { $content .= $ipb_result[2]."</i> - ".$stamp."<br>\n"; } } По-поводу того, что блок не работает. Необходимо внимательно отнестись к заполнению пользовательской части скрипта. Напоминаю, это нижеследующая часть: // Edit the following to suit your site $ipb_path = "forums/index.php"; // path from phpNuke root directory to IPB index.php $ipb_image_path = "forums/style_images/1/newpost.gif"; // Image to show beside posts. $ipb_table_prefix = "ibf"; // change if your IPB table prefix is not ibf_ $limit = "10"; // How many latest threads would you like to display? $noshow = "0"; // Don't show posts from these forums - seperate IDs with commas, eg: "2,8" $scroll = "1"; // Scroll - 1=On, 0=Off $timeoffset = "+0"; // Differance between server time and GMT (or another timezone). Alters displayed post times. Use + or - and amount of offset in hours (eg: "+6") $timezone = "GMT"; // Simply changes the "Times shown are.." message // IPB database information - ONLY required if PHP-Nuke & IPB do not share the same database $ipb_dbhost = "localhost"; //IPB database host $ipb_dbuser = ""; // IPB database username $ipb_dbpass = ""; // IPB database password $ipb_dbname = ""; // IPB database name // End user edits что-бы узнать, как прописывается префикс в базе данных, нужно зайти в PHPMyAdmin (или просто вспомнить, какой префикс был задан при установке форума. Это может быть ibf или ibf_). Кроме того существует ещё одна возможная причина неработоспособности блока. Выборка значений из базы данных осуществляется в следующих строках скрипта: if (is_admin($admin)) { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics ORDER BY last_post DESC LIMIT ".$limit); } else { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit); } } else { $ipb_connect = sql_connect($ipb_dbhost, $ipb_dbuser, $ipb_dbpass, $ipb_dbname); if (is_admin($admin)) { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); } else { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); }} Выборка осуществляется из таблицы ".$ipb_table_prefix."_topics, где $ipb_table_prefix, это тот самый префикс (приставка) к таблице. Допустим, что искомая таблица в базе данных имеет вид ibf_topics. Тогда префикс нужно вводить ibf. Если таблица имеет вид ibftopics, то нужно исправить все ".$ipb_table_prefix."_topics на ".$ipb_table_prefix."topics. Ниже приведён исходный код блока, просто тот который я закачал, я подгонял под свой форум. Добавлено в [mergetime]1107806544[/mergetime] <?php /******************************************/ /* Latest Threads from InvisionPowerBoard */ /* A block for PHP-Nuke 7.0 */ /* By Holbrookau */ /* http://ipbnuke.net */ /******************************************/ if (eregi("block-IPB_Last_Threads.php", $PHP_SELF)) { Header("Location: index.php"); die(); } global $admin, $db; // Edit the following to suit your site $ipb_path = "forums/index.php"; // path from phpNuke root directory to IPB index.php $ipb_image_path = "forums/style_images/1/newpost.gif"; // Image to show beside posts. $ipb_table_prefix = "ibf"; // change if your IPB table prefix is not ibf_ $limit = "10"; // How many latest threads would you like to display? $noshow = "0"; // Don't show posts from these forums - seperate IDs with commas, eg: "2,8" $scroll = "1"; // Scroll - 1=On, 0=Off $timeoffset = "+0"; // Differance between server time and GMT (or another timezone). Alters displayed post times. Use + or - and amount of offset in hours (eg: "+6") $timezone = "GMT"; // Simply changes the "Times shown are.." message // IPB database information - ONLY required if PHP-Nuke & IPB do not share the same database $ipb_dbhost = "localhost"; //IPB database host $ipb_dbuser = ""; // IPB database username $ipb_dbpass = ""; // IPB database password $ipb_dbname = ""; // IPB database name // End user edits if (!$ipb_dbuser && !$ipb_dbpass && !$ipb_dbname) { if (is_admin($admin)) { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics ORDER BY last_post DESC LIMIT ".$limit); } else { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit); } } else { $ipb_connect = sql_connect($ipb_dbhost, $ipb_dbuser, $ipb_dbpass, $ipb_dbname); if (is_admin($admin)) { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); } else { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."_topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); }} if ($scroll=="1") { $content = " <MARQUEE behavior=\"scroll\" align=\"left\" direction=\"up\" height=\"150\" width=\"100%\" scrollamount=\"1\" scrolldelay=\"10\" onmouseover='this.stop()' onmouseout='this.start()'>"; } while($ipb_result = $db->sql_fetchrow($ipb_query)) { $timestamp = $ipb_result[5]+$timeoffset*3600; $stamp = date('jS M g:i a', $timestamp); $content .= "<br><img src=\"".$ipb_image_path."\"> <b><a href=\"/".$ipb_path."?act=ST&f=".$ipb_result[4]."&t=".$ipb_result[0]."&view=getnewpost\" target=\"_blank\">".$ipb_result[1]."</a></b> <i>by "; if($ipb_result[3] != 0) {$content .= "<a href=\"".$ipb_path."?act=Profile&CODE=03&MID=".$ipb_result[3]."\" target=\"_blank\">".$ipb_result[2]."</a></i> - ".$stamp."<br>\n"; } else { $content .= $ipb_result[2]."</i> - ".$stamp."<br>\n"; } } $content .= "<center><br>Times shown are ".$timezone.".</center>"; ?> Да кстати, что-бы вы не подумали, авторство на этот блок не принадлежит мне, блок был взят с сайта http://ipbnuke.net . Скопируйте этот код и вставьте в файл с названием block-IPB_Last_Threads.php
  2. Какая версия PHP-Nuke и форума IPB ?
  3. Можно немного поподробнее, в чём выражается неработоспособность, выдаваемые ошибки и т.п.
  4. 1 245 скачиваний

    Блок со скроллингом для портала PHP-Nuke, который выводит поледние сообщения c форума IPB. Полностью настраиваем и лёгок в установке.
    Бесплатный
  5. Мод: Последние сообщения форума (скроллинг-блок) Категория: Моды Совместимость: 2.0.x Описание: Блок со скроллингом для портала PHP-Nuke, который выводит поледние сообщения c форума IPB. Полностью настраиваем и лёгок в установке. Подробнее... Скачать
  6. Меняешь в этой строчке 1 на 0 $scroll = "1"; // Scroll - 1=On, 0=Off
  7. Представляю вашему вниманию скроллинг-блок для портала, построенного на основе PHP-Nuke, выводящего последние сообщения форума на движке IPB. Блок полностю настраивается, работает на всех платформах. <?php /*****************************/ /* Latest Threads from IPB */ /*A scrolling block for PHP-Nuke 6.9-7.0*/ /*****************************/ if (eregi("block-IPB_Last_Threads.php", $PHP_SELF)) { Header("Location: index.php"); die(); } global $admin, $db; // Edit the following to suit your site $ipb_path = "forum/index.php"; // path from phpNuke root directory to IPB index.php $ipb_image_path = "forum/style_images/1/newpost.gif"; // Image to show beside posts. $ipb_table_prefix = "ibf"; // change if your IPB table prefix is not ibf_ $limit = "10"; // How many latest threads would you like to display? $noshow = "0"; // Don't show posts from these forums - seperate IDs with commas, eg: "2,8" $scroll = "1"; // Scroll - 1=On, 0=Off // IPB database information - ONLY required if PHP-Nuke & IPB do not share the same database $ipb_dbhost = "localhost"; //IPB database host $ipb_dbuser = ""; // IPB database username $ipb_dbpass = ""; // IPB database password $ipb_dbname = ""; // IPB database name // End user edits if (!$ipb_dbuser && !$ipb_dbpass && !$ipb_dbname) { if (is_admin($admin)) { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."topics ORDER BY last_post DESC LIMIT ".$limit); } else { $ipb_query = $db->sql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit); } } else { $ipb_connect = sql_connect($ipb_dbhost, $ipb_dbuser, $ipb_dbpass, $ipb_dbname); if (is_admin($admin)) { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."topics ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); } else { $ipb_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id, last_post FROM ".$ipb_table_prefix."topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit, $ipb_connect); }} if ($scroll=="1") { $content = " <MARQUEE behavior=\"scroll\" align=\"left\" direction=\"up\" height=\"200\" width=\"100%\" scrollamount=\"2\" scrolldelay=\"20\" onmouseover='this.stop()' onmouseout='this.start()'>"; } $content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Последние ".$limit." сообщений</b></center>"; while($ipb_result = $db->sql_fetchrow($ipb_query)) { $content .= "<br><img src=\"".$ipb_image_path."\"> <b><a href=\"/".$ipb_path."?act=ST&f=".$ipb_result[4]."&t=".$ipb_result[0]."&view=getnewpost\">".$ipb_result[1]."</a></b><font color=\"#666666\"><i> оставлено "; if($ipb_result[3] != 0) {$content .= "<a href=\"".$ipb_path."?act=Profile&CODE=03&MID=".$ipb_result[3]."\">".$ipb_result[2]."</a></i><br>\n"; } else { $content .= $ipb_result[2]."</i><br>\n"; } } ?>
  8. Ну и я постараюсь внести свою лепту в развитие общего дела. Код для вставки в ssi.php, который работает в версии PHP-Nuke 6.9 + IPB 2.0.3 выглядит так: //------------------------------------------------- // Last Posts //------------------------------------------------- function do_lastposts() { global $DB, $ibforums, $root_path, $templates_dir, $std, $INFO; $admin_forums = '(0)'; // вместо 0 вставить номера закрытых форумов или оставить 0 для показа всех $limit = "5"; // количество новостей $prefix = $INFO['sql_tbl_prefix']; $template = load_template("lastposts.html"); $to_echo = ""; $DB->query( "SELECT pid, author_name, post_date, forum_id, topic_id, author_id, title, name FROM ".$prefix."posts, ".$prefix."topics, ".$prefix."forums WHERE tid=topic_id AND forum_id=id AND forum_id NOT IN ".$admin_forums." ORDER BY pid DESC LIMIT 0,".$limit." " ); if ( ! $DB->get_num_rows() ) { fatal_error("Could not get the information from the database"); } while( $out = $DB->fetch_row($query) ) { $thread_title = $out['title']; $forum_name = $out['name']; $author = $out['author_name']; $out['post_date'] = $std->get_date( $out['post_date'], 'LONG' ); $date = $out['post_date']; $to_echo .= parse_template( $template,array ( 'thread_url' => $ibforums->base_url."?act=ST&f=".$out['forum_id']."&t=".$out['topic_id']."&hl=entry".$out['pid'], 'thread_title' => $thread_title, 'forum_url' => $ibforums->base_url."?act=SF&f=".$out['forum_id'], 'forum_name' => $forum_name, 'date' => $date, 'author' => $author, 'profile_link' => $ibforums->base_url."?act=Profile&CODE=03&MID=".$out['author_id']) ); } echo $to_echo; exit(); } Исправлены названия таблиц в базе. Кроме того вопрос. Никто не пытался переделать этот блок в блок со скроллингом. А то выглядит как-то громоздко.
×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.