Webmaster общности: Predpriemach.com | SearchEngines.bg

    Последни теми от 1 раздел

    Автор: djvato

    Здравейте … много добро уроче за теми от един раздел при това показва колко хора са писали в темата и т.н. Winking

    правите един файл topic.php да кажем слагате го в главната директория на сайта ви не в форума щот няма да бачка от тук

    $phpbb_root_path = ‘./forum/’;

    променяте пътя до форума ви … спрямо сайта

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    
    <?php
    $forum = '66'; кой е форума ( раздела ) от който искаш да показва
    $limit = '5'; / колко да показва
    $show = 'full';
    $date_time = 'short';
    $topic_link_type = 'topic';
    $comment = 'topic';
    $phpbb_root_path = './forum/'; / пътя до форума
    if ( !defined('IN_PHPBB') )
    {
    define('IN_PHPBB', true);
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);
    include($phpbb_root_path . 'config.'.$phpEx);
    }
    
    if ($show == '' || $show == 'full')
    {
    
    $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' AND `topic_moved_id` = '0' ORDER BY `topic_id` DESC LIMIT {$limit}");
    }
    
    else if ($show == 'topic')
    {
    $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$_GET['t']}' ORDER BY `topic_id` DESC");
    }
    
    
    while ($echo_topic = $db->sql_fetchrow($grab_topics))
    {
    
    $grab_posts = $db->sql_query("SELECT * FROM `{$table_prefix}posts` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$echo_topic['topic_id']}' LIMIT 1");
    
    
    while ($echo_post = $db->sql_fetchrow($grab_posts))
    {
    
    $grab_posts_text = $db->sql_query("SELECT * FROM `{$table_prefix}posts_text` WHERE `post_id` = '{$echo_post['post_id']}'");
    
    
    while($echo_text = $db->sql_fetchrow($grab_posts_text))
    {
    
    $find_user = $db->sql_query("SELECT * FROM `{$table_prefix}users` WHERE `user_id` = '{$echo_post['poster_id']}'");
    
    
    while ($echo_user = $db->sql_fetchrow($find_user))
    {
    
    
    $echo_text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $echo_text);
    
    // BBCode
    $echo_text = str_replace("","<strong>",$echo_text);
    $echo_text = str_replace("","</strong>",$echo_text);
    
    $echo_text = str_replace("[i]","<em>",$echo_text);
    $echo_text = str_replace("[/i]","</em>",$echo_text);
    
    $echo_text = str_replace("[u]","<u>",$echo_text);
    $echo_text = str_replace("[/u]","</u>",$echo_text);
    
    $echo_text = preg_replace('/\[quote=(.*)\](.*)\[\/quote\]/Usi','<div style=\"padding: 7px\">$2</div>',$echo_text);
    
    $echo_text = str_replace("[quote]","<strong>Quote</strong><em>",$echo_text);
    $echo_text = str_replace("[/quote]","</em>",$echo_text);
    
    $echo_text = str_replace("[ code]","<strong>Code</strong><em>",$echo_text);
    $echo_text = str_replace("[ /code]","</em>",$echo_text);
    
    $echo_text = preg_replace('/\[list\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
    $echo_text = preg_replace('/\[list=(.*)\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
    
    $echo_text = str_replace("[img]","<img src=\"",$echo_text);
    $echo_text = str_replace("[/img]","\" alt=\"image\" />",$echo_text);
    
    $echo_text = preg_replace('/\[url\](.*)\[\/url\]/Usi','<a href="$1">$1</a>',$echo_text);
    $echo_text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Usi','<a href="$1">$2</a>',$echo_text);
    
    $echo_text = preg_replace('/\[color=(.*)\](.*)\[\/color\]/Usi','<span style="{color:$1}">$2</span>',$echo_text);
    $echo_text = preg_replace('/\[size=(.*)\](.*)\[\/size\]/Usi','<span style="{font-size:$1pt}">$2</span>',$echo_text);
    
    $echo_text = str_replace("\n", "\n<br />\n", $echo_text);
    
    
    if($date_time == "long")
    {
    $echo_topic['topic_time'] = strftime("%A %e %B %H:%M",$echo_topic['topic_time']);
    }
    
    
    if ($date_time == "short")
    {
    $echo_topic['topic_time'] = strftime("%a %e %b %H:%M",$echo_topic['topic_time']);
    }
    
    
    if ($comment == 'topic')
    {
    $comment_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
    }
    
    
    if ($comment == 'reply')
    {
    $comment_link = "{$phpbb_root_path}posting.php?mode=reply&t={$echo_topic['topic_id']}";
    }
    
    
    if ($topic_link_type == 'topic')
    {
    $topic_link = "?show1=topic&t={$echo_topic['topic_id']}";
    }
    
    
    if ($topic_link_type == 'phpbb')
    {
    $topic_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
    }
    
    
    
    if ($show != 'full' && !isset($_GET['show1']))
    {
    echo "<a href='{$topic_link}'>{$echo_text['post_subject']}</a><br />";
    }
    
    
    else if ($show == 'full')
    {
    echo "
    <strong>{$echo_text['post_subject']}</strong> <br />
    <br />
    {$echo_text['post_text']}
    <br />
    <br />
    <a href=\"{$comment_link}\">Коментари {$echo_topic['topic_replies']}</a>пустнато на <strong>{$echo_topic['topic_time']}</strong> от <strong>{$echo_user['username']}</strong>
    
    <hr size=\"1\">
    ";
    }
    
    
    if ($_GET['show1'] == 'topic')
    {
    echo "
    <strong>{$echo_text['post_subject']}</strong>
    <br />
    <br />
    {$echo_text['post_text']}
    <br />
    <br />
    <a href=\"{$comment_link}\">Коментари {$echo_topic['topic_replies']}</a> пустнато на <strong>{$echo_topic['topic_time']}</strong> от <strong>{$echo_user['username']}</strong>
    <hr size=\"1\">
    ";
    }
    }
    }
    }
    }
    ?>

    Оставете коментар