|
|
|
| кто-нибудь пользуется форумом от phpbb
не могу найти такой мод, чтоб выводил на главную страницу моего сайт не только НАЗВАНИЯ последних тем, но и посты в них..
существует ли такой мод в природе...??? | |
|
|
|
|
|
|
|
для: MadeInUSSR
(02.08.2006 в 18:47)
| | Не знаю, а что мешает дописать выбор поста из БД по аналогии с названием? | |
|
|
|
|
|
|
|
для: 12345
(02.08.2006 в 18:49)
| | мешает недостаток знания php /mysql :( | |
|
|
|
|
|
|
|
для: MadeInUSSR
(02.08.2006 в 20:14)
| | Выложите страницу, где выводится список тем и еще желательно структуру таблицы с постами. | |
|
|
|
|
|
|
|
для: Unkind™
(02.08.2006 в 20:32)
| | recent.php сам скрипт
<?php
/***************************************************************************
* recent.php
* -------------------
* begin : Saturday, Mar 05, 2005
* copyright : (C) 2005 Xpert
* email : xpert@phpbbguru.net
*
* $Id: recent.php,v 1.0.4 2005/08/03 20:54:00 xpert Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/* Config section */
$cfg_ignore_forums = '0'; // ids of forums you don't want to display, separated by commas
$cfg_nm_topics = 5; // number of topics to output
$cfg_max_topic_length = 30; // max topic length, if more, title will be shortened
/* End of config */
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Let's prevent caching
//
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
header ('Cache-Control: no-cache, pre-check=0, post-check=0');
}
else
{
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: 0');
header ('Pragma: no-cache');
//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
// Building URL
//
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
$script_name = ($script_name == '') ? $script_name : '/' . $script_name;
$board_path = $server_protocol . $server_name . $server_port . $script_name;
$viewtopic_url = $board_path . '/viewtopic.' . $phpEx;
//
// Session management
// I don't want to log user in, so let's trick
//
$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = ". ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not obtain anonymous data from user table', '', __LINE__, __FILE__, $sql);
}
$userdata = $db->sql_fetchrow($result);
init_userprefs($userdata);
//
// Load template
//
$template->set_filenames(array(
'body' => 'recent_body.tpl')
);
// Fetching topics of public forums
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
WHERE t.forum_id = f.forum_id
AND f.auth_read = " . AUTH_ALL . "
AND t.forum_id NOT IN(" . $cfg_ignore_forums .")
AND p.post_id = t.topic_last_post_id
AND t.topic_moved_id = 0
ORDER BY p.post_id DESC LIMIT $cfg_nm_topics";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not fetch recent topics information.", '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$topic_title = $row['topic_title'];
if ( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$topic_title = ( strlen($topic_title) > $cfg_max_topic_length ) ? substr($topic_title, 0, $cfg_max_topic_length) . '…' : $topic_title;
$template->assign_block_vars('topicrow', array(
'U_TOPIC' => $viewtopic_url . '?' . POST_TOPIC_URL . '=' . $row['topic_id'],
'TOPIC_TITLE' => str_replace("'", "\'", $topic_title)
));
}
//
// Output
//
$template->pparse('body');
?>
|
http://www.tsvetayeva.com/forum/recent.php
прикрепила файл структуры таблицы | |
|
|
|
|
|
|
|
для: MadeInUSSR
(03.08.2006 в 10:36)
| | У меня что-то в документе, что в аттаче только названия таблиц... | |
|
|
|
|
|
|
|
для: Unkind™
(04.08.2006 в 21:48)
| | я вот тут решила попробовать написать сама (с помощью форумов и книг)
<?php
$cfg_nm_topics=2;
$db=mysql_pconnect ('localhost','root','');
if (!$db)
{
echo 'Не могу подключиться к бд!!!';
}
mysql_select_db ('photofor_tsforum');
if (!mysql_select_db ('photofor_tsforum'))
{
echo 'Не могу выбрать бд!!!';
}
$ath=mysql_query("SELECT * FROM phpbb_posts_text order by post_id desc LIMIT $cfg_nm_topics;");
if (!$ath)
{
echo "Bad";
exit ();
}
else
{
echo "<table bgcolor=\"#FFFFFF\" border=\"0\" width=\"100%\">";
while ($phpbb_posts_text=mysql_fetch_array($ath))
{
$text=$phpbb_posts_text['post_text'];
echo "<tr><td width=\"25\" valign=\"top\"><font size=\"2\" face=\"Times New Roman, Times, serif\"><strong>".$phpbb_posts_text['post_subject'].":"."</strong></font> </td><td valign=\"top\" align=\"left\">";
$words=explode(" ", $text);
for ($i=0; $i<10; $i++)
echo "<font size=\"2\" face=\"Times New Roman, Times, serif\">".$words[$i]." "."</font>";
echo " <br><a href=\"http://localhost/forum/viewtopic.php?p=".$phpbb_posts_text['post_id']."#".$phpbb_posts_text['post_id']."\">"."<font size=\"2\" face=\"Times New Roman, Times, serif\">Читать дальше</font></a> <a href=\"http://localhost/forum/posting.php?mode=quote&p=".$phpbb_posts_text['post_id']."\">"."<font size=\"2\" face=\"Times New Roman, Times, serif\">Оставить комментарий</font></a></td></tr>";
}
echo "</table>";
}
?>
|
все работает так как мне надо, только одно НО... как сделать так чтоб при выводе из БД каких либо ссылок они отображались именно как ссылки, а не текст | |
|
|
|
|
|
|
|
для: MadeInUSSR
(05.08.2006 в 08:10)
| |
$text= eregi_replace("((http://))((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z;]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:;\?\.-]*)*)", "<a href=\"\\0\">\\3</a>", $text);
|
| |
|
|
|
|
|
|
|
для: Unkind™
(05.08.2006 в 12:15)
| | добавила, но вывод делает такой
href="http://www.ya.ru">www.ya.ru | |
|
|
|
|
|
|
|
для: MadeInUSSR
(05.08.2006 в 12:31)
| | Не знаю, у меня работает... | |
|
|
|
|
|
|
|
для: Unkind™
(05.08.2006 в 13:21)
| | извините, можете я не туда вставляю этот код? подскажите, пожалуйста, куда вставить его надо | |
|
|
|
|
|
|
|
для: MadeInUSSR
(05.08.2006 в 13:42)
| | Ну у вас в коде какая переменная последним постом является? Ее и нужно обработать...
Кстати, лучше в ссылки превращать в обработчике создания темы/добавления поста...Тогда в базе уже будет Сссылка вида <a href="http://ya.ru">ya.ru</a> и не надо будет потом обрабатывать последний пост каждый раз... | |
|
|
|