Help I need a Forums Topic/Content Preview Block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Help I need a Forums Topic/Content Preview Block
syruss2125
CZ Newbie
syruss2125 has been a member for over 18 year's 18 Year Member
usa.gif kansas.gif
Gender: Male
Status: Offline
Joined: Nov 08, 2006
0.00 posts per day
Posts: 19
Points: 50
   
Using PHP-Nuke 7.x

I was hoping that you could help me make a block for my front page to preview the forum like it does in my viewforum.php file.. so that it will view the forum topic and then with a mouse over view the forum content.. not all the content just part of it..
this is my viewforum.php file.. can you use it to make a block for the front page.?
<?php
/***************************************************************************
*                               viewforum.php
*                            -------------------
*   begin                : Saturday, Feb 13, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : [ Register or login to view links on this board. ]
*
*   Id: viewforum.php,v 1.139.2.12 2004/03/13 15:08:23 acydburn 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.
*
***************************************************************************/

if ( !defined('MODULE_FILE') )
{
   die("You can't access this file directly...");
}
if ($popup != "1"){
    $module_name = basename(dirname(__FILE__));
    require("modules/".$module_name."/nukebb.php");
}
else
{
    $phpbb_root_path = 'modules/Forums/';
    $phpbb_root_test = '';
}
define('IN_PHPBB', true);
//$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_test . 'includes/bbcode.'.$phpEx);
//
// End of modification by Dauthus to make compliant with PHP-Nuke
//

//
// Start initial var setup
//
if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
{
        $forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
}
else if ( isset($HTTP_GET_VARS['forum']))
{
        $forum_id = intval($HTTP_GET_VARS['forum']);
}
else
{
        $forum_id = '';
}

$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;

if ( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{
        $mark_read = (isset($HTTP_POST_VARS['mark'])) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
}
else
{
        $mark_read = '';
}
//
// End initial var setup
//

//
// Check if the user has actually sent a forum ID with his/her request
// If not give them a nice error page.
//
if ( !empty($forum_id) )
{
        $sql = "SELECT *
                FROM " . FORUMS_TABLE . "
                WHERE forum_id = '$forum_id'";
        if ( !($result = $db->sql_query($sql)) )
        {
                message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
        }
}
else
{
        message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}

//
// If the query doesn't return any rows this isn't a valid forum. Inform
// the user.
//
if ( !($forum_row = $db->sql_fetchrow($result)) )
{
        message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id, $nukeuser);
init_userprefs($userdata);
//
// End session management
//

//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);

if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
{
        if ( !$userdata['session_logged_in'] )
        {
                $redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
                $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", $_SERVER["SERVER_SOFTWARE"]) ) ? "Refresh: 0; URL=" : "Location: ";
                header($header_location . append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
                exit;
        }
        //
        // The user is not authed to read this forum ...
        //
        $message = ( !$is_auth['auth_view'] ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);

        message_die(GENERAL_MESSAGE, $message);
}
//
// End of auth check
//

//
// Handle marking posts
//
if ( $mark_read == 'topics' )
{
        if ( $userdata['session_logged_in'] )
        {
                $sql = "SELECT MAX(post_time) AS last_post
                        FROM " . POSTS_TABLE . "
                        WHERE forum_id = '$forum_id'";
                if ( !($result = $db->sql_query($sql)) )
                {
                        message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
                }

                if ( $row = $db->sql_fetchrow($result) )
                {
                        $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
                        $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();

                        if ( ( count($tracking_forums) + count($tracking_topics) ) >= 150 && empty($tracking_forums[$forum_id]) )
                        {
                                asort($tracking_forums);
                                unset($tracking_forums[key($tracking_forums)]);
                        }

                        if ( $row['last_post'] > $userdata['user_lastvisit'] )
                        {
                                $tracking_forums[$forum_id] = time();

                                setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
                        }
                }

                $template->assign_vars(array(
                        'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
                );
        }

        $message = $lang['Topics_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a> ');
        message_die(GENERAL_MESSAGE, $message);
}
//
// End handle marking posts
//

$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : '';

//
// Do the forum Prune
//
if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
{
        if ( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] )

        {

                include("includes/prune.php");

                require("includes/functions_admin.php");
                auto_prune($forum_id);
        }
}
//
// End of forum prune
//

//
// Obtain list of moderators of each forum
// First users, then groups ... broken into two queries
//
$sql = "SELECT u.user_id, u.username
        FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
        WHERE aa.forum_id = '$forum_id'
                AND aa.auth_mod = " . TRUE . "
                AND g.group_single_user = '1'
                AND ug.group_id = aa.group_id
                AND g.group_id = aa.group_id
                AND u.user_id = ug.user_id
        GROUP BY u.user_id, u.username
        ORDER BY u.user_id";
if ( !($result = $db->sql_query($sql)) )
{
        message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

$moderators = array();
while( $row = $db->sql_fetchrow($result) )
{
        $moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
}

$sql = "SELECT g.group_id, g.group_name
        FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
        WHERE aa.forum_id = '$forum_id'
                AND aa.auth_mod = " . TRUE . "
                AND g.group_single_user = '0'
                AND g.group_type <> ". GROUP_HIDDEN ."
                AND ug.group_id = aa.group_id
                AND g.group_id = aa.group_id
        GROUP BY g.group_id, g.group_name
        ORDER BY g.group_id";
if ( !($result = $db->sql_query($sql)) )
{
        message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
        $moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
}

$l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$forum_moderators = ( count($moderators) ) ? implode(', ', $moderators) : $lang['None'];
unset($moderators);

//
// Generate a 'Show topics in previous x days' select box. If the topicsdays var is sent
// then get it's value, find the number of topics with dates newer than it (to properly
// handle pagination) and alter the main query
//
$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
$previous_days_text = array($lang['All_Topics'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);

if ( !empty($HTTP_POST_VARS['topicdays']) || !empty($HTTP_GET_VARS['topicdays']) )
{
        $topic_days = ( !empty($HTTP_POST_VARS['topicdays']) ) ? intval($HTTP_POST_VARS['topicdays']) : intval($HTTP_GET_VARS['topicdays']);
        $min_topic_time = time() - ($topic_days * 86400);

        $sql = "SELECT COUNT(t.topic_id) AS forum_topics
                FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
                WHERE t.forum_id = '$forum_id'
                        AND p.post_id = t.topic_last_post_id
                        AND p.post_time >= '$min_topic_time'";

        if ( !($result = $db->sql_query($sql)) )
        {
                message_die(GENERAL_ERROR, 'Could not obtain limited topics count information', '', __LINE__, __FILE__, $sql);
        }
        $row = $db->sql_fetchrow($result);

        $topics_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1;
        $limit_topics_time = "AND p.post_time >= $min_topic_time";

        if ( !empty($HTTP_POST_VARS['topicdays']) )
        {
                $start = 0;
        }
}
else
{
        $topics_count = ( $forum_row['forum_topics'] ) ? $forum_row['forum_topics'] : 1;

        $limit_topics_time = '';
        $topic_days = 0;
}

$select_topic_days = '<select name="topicdays">';
for($i = 0; $i < count($previous_days); $i++)
{
        $selected = ($topic_days == $previous_days[$i]) ? ' selected="selected"' : '';
        $select_topic_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
}
$select_topic_days .= '</select>';

//  Was replaced with new script below.. //
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
//$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
//        FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
//        WHERE t.forum_id = '$forum_id'
//                AND t.topic_poster = u.user_id
//                AND p.post_id = t.topic_last_post_id
//                AND p.poster_id = u2.user_id
//                AND t.topic_type = " . POST_ANNOUNCE . "
//
//  This is the cut point for the replacement below. //
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, pt.post_text, pt.bbcode_uid
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_last_post_id
      AND p.post_id = pt.post_id
      AND p.poster_id = u2.user_id
      AND t.topic_type = " . POST_ANNOUNCE . "
        ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$topic_rowset = array();
$total_announcements = 0;
while( $row = $db->sql_fetchrow($result) )
{
        $topic_rowset[] = $row;
        $total_announcements++;
}

$db->sql_freeresult($result);

//  Replacement Script below this one. //
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
//$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
//        FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
//        WHERE t.forum_id = '$forum_id'
//                AND t.topic_poster = u.user_id
//                AND p.post_id = t.topic_first_post_id
//                AND p2.post_id = t.topic_last_post_id
//                AND u2.user_id = p2.poster_id
//                AND t.topic_type <> " . POST_ANNOUNCE . "
//
//  This was replace with the below script. //
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, pt.post_text, pt.bbcode_uid
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_first_post_id
      AND p2.post_id = t.topic_last_post_id
      AND p2.post_id = pt.post_id
      AND u2.user_id = p2.poster_id
      AND t.topic_type <> " . POST_ANNOUNCE . "
                $limit_topics_time
        ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
        LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$total_topics = 0;
while( $row = $db->sql_fetchrow($result) )
{
        $topic_rowset[] = $row;
        $total_topics++;
}

$db->sql_freeresult($result);

//
// Total topics ...
//
$total_topics += $total_announcements;

//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

//
// Post URL generation for templating vars
//
$template->assign_vars(array(
        'L_DISPLAY_TOPICS' => $lang['Display_topics'],

        'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&amp;" . POST_FORUM_URL . "=$forum_id"),

        'S_SELECT_TOPIC_DAYS' => $select_topic_days,
        'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&amp;start=$start"))
);

//
// User authorisation levels output
//
$s_auth_can = ( ( $is_auth['auth_post'] ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />';
$s_auth_can .= ( ( $is_auth['auth_reply'] ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />';
$s_auth_can .= ( ( $is_auth['auth_edit'] ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />';
$s_auth_can .= ( ( $is_auth['auth_delete'] ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />';
$s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '<br />';

if ( $is_auth['auth_mod'] )
{
        $s_auth_can .= sprintf($lang['Rules_moderate'], '<a href="' . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
}

//
// Mozilla navigation bar
//
$nav_links['up'] = array(
        'url' => append_sid('index.'.$phpEx),
        'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
);

//
// Dump out the page header and load viewforum template
//
define('SHOW_ONLINE', true);
$page_title = $lang['View_forum'] . ' - ' . $forum_row['forum_name'];
include("includes/page_header.php");

$template->set_filenames(array(
        'body' => 'viewforum_body.tpl')
);
make_jumpbox('viewforum.'.$phpEx);

$template->assign_vars(array(
        'FORUM_ID' => $forum_id,
        'FORUM_NAME' => $forum_row['forum_name'],
        'MODERATORS' => $forum_moderators,
        'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],

        'FOLDER_IMG' => $images['folder'],
        'FOLDER_NEW_IMG' => $images['folder_new'],
        'FOLDER_HOT_IMG' => $images['folder_hot'],
        'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'],
        'FOLDER_LOCKED_IMG' => $images['folder_locked'],
        'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'],
        'FOLDER_STICKY_IMG' => $images['folder_sticky'],
        'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'],
        'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'],
        'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'],

        'L_TOPICS' => $lang['Topics'],
        'L_REPLIES' => $lang['Replies'],
        'L_VIEWS' => $lang['Views'],
        'L_POSTS' => $lang['Posts'],
        'L_LASTPOST' => $lang['Last_Post'],
        'L_MODERATOR' => $l_moderators,
        'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'],
        'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
        'L_NO_NEW_POSTS' => $lang['No_new_posts'],
        'L_NEW_POSTS' => $lang['New_posts'],
        'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
        'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
        'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
        'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
        'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
        'L_STICKY' => $lang['Post_Sticky'],
        'L_POSTED' => $lang['Posted'],
        'L_JOINED' => $lang['Joined'],
        'L_AUTHOR' => $lang['Author'],

        'S_AUTH_LIST' => $s_auth_can,

        'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),

        'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))
);
//
// End header
//

//
// Okay, lets dump out the page ...
//
if( $total_topics )
{
        for($i = 0; $i < $total_topics; $i++)
        {
                $topic_id = $topic_rowset[$i]['topic_id'];

                $topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
//
// Mouse hover topic preview MOD - BEGIN
//
      $topic_content = $topic_rowset[$i]['post_text'];
      $bbcode_uid = $topic_rowset[$i]['bbcode_uid'];
      $topic_content = bbencode_strip($topic_content, $bbcode_uid);

      if (strlen($topic_content) > 200)
      {
         $topic_content = substr($topic_content, 0, 200) . "...";
      }
      else
      {
         $topic_content = $topic_content;
      }

//
// Mouse hover topic preview MOD - END
//

                $replies = $topic_rowset[$i]['topic_replies'];

                $topic_type = $topic_rowset[$i]['topic_type'];

                if( $topic_type == POST_ANNOUNCE )
                {
                        $topic_type = $lang['Topic_Announcement'] . ' ';
                }
                else if( $topic_type == POST_STICKY )
                {
                        $topic_type = $lang['Topic_Sticky'] . ' ';
                }
                else
                {
                        $topic_type = '';
                }

                if( $topic_rowset[$i]['topic_vote'] )
                {
                        $topic_type .= $lang['Topic_Poll'] . ' ';
                }

                if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
                {
                        $topic_type = $lang['Topic_Moved'] . ' ';
                        $topic_id = $topic_rowset[$i]['topic_moved_id'];

                        $folder_image =  $images['folder'];
                        $folder_alt = $lang['Topics_Moved'];
                        $newest_post_img = '';
                }
                else
                {
                        if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
                        {
                                $folder = $images['folder_announce'];
                                $folder_new = $images['folder_announce_new'];
                        }
                        else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
                        {
                                $folder = $images['folder_sticky'];
                                $folder_new = $images['folder_sticky_new'];
                        }
                        else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
                        {
                                $folder = $images['folder_locked'];
                                $folder_new = $images['folder_locked_new'];
                        }
                        else
                        {
                                if($replies >= $board_config['hot_threshold'])
                                {
                                        $folder = $images['folder_hot'];
                                        $folder_new = $images['folder_hot_new'];
                                }
                                else
                                {
                                        $folder = $images['folder'];
                                        $folder_new = $images['folder_new'];
                                }
                        }

                        $newest_post_img = '';
                        if( $userdata['session_logged_in'] )
                        {
                                if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] )
                                {
                                        if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                        {
                                                $unread_topics = true;

                                                if( !empty($tracking_topics[$topic_id]) )
                                                {
                                                        if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
                                                        {
                                                                $unread_topics = false;
                                                        }
                                                }

                                                if( !empty($tracking_forums[$forum_id]) )
                                                {
                                                        if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
                                                        {
                                                                $unread_topics = false;
                                                        }
                                                }

                                                if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                                {
                                                        if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
                                                        {
                                                                $unread_topics = false;
                                                        }
                                                }

                                                if( $unread_topics )
                                                {
                                                        $folder_image = $folder_new;
                                                        $folder_alt = $lang['New_posts'];

                                                        $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                                }
                                                else
                                                {
                                                        $folder_image = $folder;
                                                        $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

                                                        $newest_post_img = '';
                                                }
                                        }
                                        else
                                        {
                                                $folder_image = $folder_new;
                                                $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];

                                                $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                        }
                                }
                                else
                                {
                                        $folder_image = $folder;
                                        $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

                                        $newest_post_img = '';
                                }
                        }
                        else
                        {
                                $folder_image = $folder;
                                $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

                                $newest_post_img = '';
                        }
                }

                if( ( $replies + 1 ) > $board_config['posts_per_page'] )
                {
                        $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
                        $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';

                        $times = 1;
                        for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
                        {
                                $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&amp;start=$j") . '">' . $times . '</a>';
                                if( $times == 1 && $total_pages > 4 )
                                {
                                        $goto_page .= ' ... ';
                                        $times = $total_pages - 3;
                                        $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
                                }
                                else if ( $times < $total_pages )
                                {
                                        $goto_page .= ', ';
                                }
                                $times++;
                        }
                        $goto_page .= ' ] ';
                }
                else
                {
                        $goto_page = '';
                }

                $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");

                $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
                $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );

                $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';

                $first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']);

                $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

                $last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';

                $last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';

                $views = $topic_rowset[$i]['topic_views'];

                $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
                $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

                $template->assign_block_vars('topicrow', array(
                        'ROW_COLOR' => $row_color,
                        'ROW_CLASS' => $row_class,
                        'FORUM_ID' => $forum_id,
                        'TOPIC_ID' => $topic_id,
                        'TOPIC_FOLDER_IMG' => $folder_image,
                        'TOPIC_AUTHOR' => $topic_author,
                        'GOTO_PAGE' => $goto_page,
                        'REPLIES' => $replies,
                        'NEWEST_POST_IMG' => $newest_post_img,
                        'TOPIC_TITLE' => $topic_title,
                        'TOPIC_CONTENT' => $topic_content,
                        'TOPIC_TYPE' => $topic_type,
                        'VIEWS' => $views,
                        'FIRST_POST_TIME' => $first_post_time,
                        'LAST_POST_TIME' => $last_post_time,
                        'LAST_POST_AUTHOR' => $last_post_author,
                        'LAST_POST_IMG' => $last_post_url,

                        'L_TOPIC_FOLDER_ALT' => $folder_alt,

                        'U_VIEW_TOPIC' => $view_topic_url)
                );
        }

        $topics_count -= $total_announcements;

        $template->assign_vars(array(
                'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
                'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),

                'L_GOTO_PAGE' => $lang['Goto_page'])
        );
}
else
{
        //
        // No topics
        //
        $no_topics_msg = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one'];
        $template->assign_vars(array(
                'L_NO_TOPICS' => $no_topics_msg)
        );

        $template->assign_block_vars('switch_no_topics', array() );

}

//
// Parse the page and print
//
$template->pparse('body');

//
// Page footer
//
include("includes/page_tail.php");

?>

also here is my themes viewforum_body.tpl if it helps.

<form method="post" action="{S_POST_DAYS_ACTION}">
  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
   <tr>
     <td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><br /><span class="gensmall"><b>{L_MODERATOR}: {MODERATORS}<br /><br />{LOGGED_IN_USER_LIST}</b></span></td>
     <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
   </tr>
   <tr>
     <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
     <td align="left" valign="middle" class="nav" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
     <td align="right" valign="bottom" class="nav" nowrap="nowrap"><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
   </tr>
  </table>

  <table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
   <tr>
     <th colspan="2" align="center" height="25" class="thCornerL" nowrap="nowrap">&nbsp;{L_TOPICS}&nbsp;</th>
     <th width="50" align="center" class="thTop" nowrap="nowrap">&nbsp;{L_REPLIES}&nbsp;</th>
     <th width="100" align="center" class="thTop" nowrap="nowrap">&nbsp;{L_AUTHOR}&nbsp;</th>
     <th width="50" align="center" class="thTop" nowrap="nowrap">&nbsp;{L_VIEWS}&nbsp;</th>
     <th align="center" class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
   </tr>
   <!-- BEGIN topicrow -->
   <tr>
     <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
     <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle"title="{topicrow.TOPIC_CONTENT}">[{topicrow.TOPIC_TITLE}]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{topicrow.TOPIC_CONTENT}</a></span><span class="gensmall"><br />
      {topicrow.GOTO_PAGE}</span></td>
     <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
     <td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
     <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td>
     <td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
   </tr>
   <!-- END topicrow -->
   <!-- BEGIN switch_no_topics -->
   <tr>
     <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}</span></td>
   </tr>
   <!-- END switch_no_topics -->
   <tr>
     <td class="catBottom" align="center" valign="middle" colspan="6" height="28"><span class="genmed">{L_DISPLAY_TOPICS}:&nbsp;{S_SELECT_TOPIC_DAYS}&nbsp;
      <input type="submit" class="liteoption" value="{L_GO}" name="submit" />
      </span></td>
   </tr>
  </table>

  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
   <tr>
     <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
     <td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
     <td align="right" valign="middle" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span>
      </td>
   </tr>
   <tr>
     <td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
   </tr>
  </table>
</form>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td align="right">{JUMPBOX}</td>
  </tr>
</table>

<table width="100%" cellspacing="0" border="0" align="center" cellpadding="0">
   <tr>
      <td align="left" valign="top"><table cellspacing="3" cellpadding="0" border="0">
         <tr>
            <td width="20" align="left"><img src="{FOLDER_NEW_IMG}" alt="{L_NEW_POSTS}" width="19" height="18" /></td>
            <td class="gensmall">{L_NEW_POSTS}</td>
            <td>&nbsp;&nbsp;</td>
            <td width="20" align="center"><img src="{FOLDER_IMG}" alt="{L_NO_NEW_POSTS}" width="19" height="18" /></td>
            <td class="gensmall">{L_NO_NEW_POSTS}</td>
            <td>&nbsp;&nbsp;</td>
            <td width="20" align="center"><img src="{FOLDER_ANNOUNCE_IMG}" alt="{L_ANNOUNCEMENT}" width="19" height="18" /></td>
            <td class="gensmall">{L_ANNOUNCEMENT}</td>
         </tr>
         <tr>
            <td width="20" align="center"><img src="{FOLDER_HOT_NEW_IMG}" alt="{L_NEW_POSTS_HOT}" width="19" height="18" /></td>
            <td class="gensmall">{L_NEW_POSTS_HOT}</td>
            <td>&nbsp;&nbsp;</td>
            <td width="20" align="center"><img src="{FOLDER_HOT_IMG}" alt="{L_NO_NEW_POSTS_HOT}" width="19" height="18" /></td>
            <td class="gensmall">{L_NO_NEW_POSTS_HOT}</td>
            <td>&nbsp;&nbsp;</td>
            <td width="20" align="center"><img src="{FOLDER_STICKY_IMG}" alt="{L_STICKY}" width="19" height="18" /></td>
            <td class="gensmall">{L_STICKY}</td>
         </tr>
         <tr>
            <td class="gensmall"><img src="{FOLDER_LOCKED_NEW_IMG}" alt="{L_NEW_POSTS_TOPIC_LOCKED}" width="19" height="18" /></td>
            <td class="gensmall">{L_NEW_POSTS_LOCKED}</td>
            <td>&nbsp;&nbsp;</td>
            <td class="gensmall"><img src="{FOLDER_LOCKED_IMG}" alt="{L_NO_NEW_POSTS_TOPIC_LOCKED}" width="19" height="18" /></td>
            <td class="gensmall">{L_NO_NEW_POSTS_LOCKED}</td>
         </tr>
      </table></td>
      <td align="right"><span class="gensmall">{S_AUTH_LIST}</span></td>
   </tr>
</table>

I don't have a block or anything started.. helping me to make one is what i need.. thanks.. I also have the Block block-Forums_Center_Universal.php I would like to use as a template for creating this..
here is the block-Forums_Center_Universal.php
<?php
########################################################################
# Universal Latest Forums Block                                        #
# ============================================                         #
########################################################################

if (eregi("block-Universalforums.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$HideViewReadOnly = 1;   
$Last_New_Topics  = 5;   
global $prefix, $db, $sitename,$ThemeSel,$bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4,$textcolor1, $textcolor2;
$folder_path = "themes/$ThemeSel/forums/";

if(!is_dir($folder_path))
{
   $folder_path = "themes/$ThemeSel/forums/";
}

$show = "  <tr>
    <td height=\"28\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"".$folder_path."images/cellpic1.gif\">&nbsp;</td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = $db->sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC");
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow($result) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result2 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'");
      list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result2 );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }
   
   if( $topic_moved_id != 0 )
   {

      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;

$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);

$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);

                         $viewlast .="  <tr>
    <td height=\"34\" nowrap bgcolor=\"$bgcolor1\" class=\"row1\"><img src=\"".$folder_path."images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" bgcolor=\"$bgcolor1\" class=\"row1\">&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row3\"><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap bgcolor=\"$bgcolor1\" class=\"row3\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
      <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"".$folder_path."images/icon_minipost_new.gif\" border=\"0\" alt=\"Latest Post\"></a></td>
  </tr>";
}
   
   if( $Last_New_Topics == $Count_Topics ) { break 1; }
   
}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
  <tr>
    <td bgcolor=\"$bgcolor1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"$bgcolor2\">
        <tr>
          <td><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">
  <tr>
    <th height=\"28\" colspan=\"2\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thcornerl\"><font color=\"$textcolor1\"><strong>Topics</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
    <th width=\"100\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Author&nbsp;</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Views&nbsp;</strong></font></th>
    <th align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thcornerr\"><font color=\"$textcolor1\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
  </tr>";
    $content .= "$viewlast";

$content .= "$show";

?>

If you can help me please..
thanks CodeWiz.


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Have you tried making some changes yourself? We dont mind helping but don't want to do it for you.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Help I need a Forums Topic/Content Preview Block
syruss2125
CZ Newbie
syruss2125 has been a member for over 18 year's 18 Year Member
usa.gif kansas.gif
Gender: Male
Status: Offline
Joined: Nov 08, 2006
0.00 posts per day
Posts: 19
Points: 50
   
Yes i have tried alot of things and I can't figure this out..
I don't script very well.. I most chage scripts to suit my needs..
I done this and it's not working.. no matter what I try cause i'm not sure of what i'm doing..
I have it in my forums to post like this..

Topic
[preview of last post]
preview..text.....

Sample at [ Register or login to view links on this board.]

here is the front page.. where the block is.. [ Register or login to view links on this board.]

Please I don't ask people if i haven't done everything I could do figure it out for myself first.. Even if you could give me a file on where to put the new script parts into my block script would be grat.. i'll edit my block.. I just need to knw where and how.. sorry..

Don't mean to be shuch a newb..



Back to top Reply with quote
#4   re: Help I need a Forums Topic/Content Preview Block
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
Not exactly sure what your looking for. This is the mod to display the first post on viewtopic.
[ Register or login to view links on this board. ]



Back to top Reply with quote
#5   re: Help I need a Forums Topic/Content Preview Block
syruss2125
CZ Newbie
syruss2125 has been a member for over 18 year's 18 Year Member
usa.gif kansas.gif
Gender: Male
Status: Offline
Joined: Nov 08, 2006
0.00 posts per day
Posts: 19
Points: 50
   
What i been tring to do is edit the Block file..

You have a center block on the front page of a php nuke site that shows the last 5 forum topics..

I would like it to show up like on my forums but on the front page center block..

I have post a link to my site that shows what they look like..

my forms show the preview of the last post under that topic..

I been working on this for the last month and have had no progress..

If you can help me please.. I would apreciate it very much..

I'll even show the credit that would be all yours on my site.. plus add a advertisement to you site on mine..

'



Back to top Reply with quote
#6   re: Help I need a Forums Topic/Content Preview Block
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
Can you attach your block? or current progress. If no progress attach the block you want modded.

Just so we are clear,

You want a block to preview the last post?



Back to top Reply with quote
#7   re: Help I need a Forums Topic/Content Preview Block
syruss2125
CZ Newbie
syruss2125 has been a member for over 18 year's 18 Year Member
usa.gif kansas.gif
Gender: Male
Status: Offline
Joined: Nov 08, 2006
0.00 posts per day
Posts: 19
Points: 50
   
No I have my forums set you with this setup file to show the last post as preview in the topic in my forums..

would like the center block to do the same..

here is the file.. I used to install it into my forums
it's a script to make it work with a mouse over effect.
I changed it alittle.. mouse over still works but there is also a preview below the Topic of the last post in that topic...
Non=changed version below.
## EasyMod 0.0.10a compliant
#################################################################
## MOD Title:       Mouse hover topic preview
## MOD Author:       Shannado <sven@shannado.nl> (Sven) http://www.shannado.nl/forumorg
## MOD Description: With this MOD an user can see preview, when he/she holds the mouse over the topic in viewforum
##               It showes the first 200 characters of the LAST post.In the HOWTO is also described how to
##               preview the FIRST post instead of the LAST Post.
##               Also in the search result screen you can preview the post (only when viewing topics)
## MOD Version:    1.0.7
##      
## Installation Level:    Easy
## Installation Time:    5 Minutes
## Files To Edit:       viewforum.php,
##                  viewforum_body.tpl,
##                  bbcode.php
## Included Files:    N/A
##
## Modified by Dauthus on 6/2/04 to be compliant with PHP-Nuke 7.2 and others?
##
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##   I have set a limit (200) on the number of characters show in the preview. You can adjust is yourself to anynumber.
##   Replace the '200' with your number. In the following code lines:
##      $topic_content = $topic_rowset[$i]['post_text'];
##
##      if (strlen($topic_content) > 200)
##      {
##         $topic_content = substr($topic_content, 0, 200) . "...";
##      }
##      else
##      {
##         $topic_content = $topic_content;
##      }
##
##
##   If you want to preview the first post instead of the last. change the next lines in viewforum.php
##   after you completed the HOW TO.
##
##
##   [ _F I N D_ ]
##
##      AND p.post_id = pt.post_id
##
##   [ _R E P L A C E   W I T H_ ]
##
##      AND t.topic_first_post_id = pt.post_id
##
##
##   [ _F I N D_ ]
##      AND p2.post_id = t.topic_last_post_id
##      AND p2.post_id = pt.post_id
##
##   [ _R E P L A C E   W I T H_ ]
##      AND p2.post_id = t.topic_last_post_id
##      AND p.post_id = pt.post_id
##
## Known Issues:
##   - Smilies & HTML code visible in preview
##
##############################################################
## MOD History:
##
## ------------
## 01-01-2002 - 0.9.0 beta
##   - Beta
##
## 01-01-2002 - 0.9.1 beta
##   - BBCode was visible in the preview. BBCode will be stripped now
##
## 01-01-2002 - 0.9.2 beta
##   - Forgot the adjust the SQL statements
##
## 01-01-2002 - 0.9.3 beta
##   - Author notes extended with HOWTO preview always the first post
##
## 01-01-2002 - 1.0.0 FINAL
##   - Final
##
## 01-01-2002 - 1.0.1 FINAL
##   - Fixed preview FIRST post Announcement. The Annoucement disappear in the viewforum.
##     The Authors Notes theerfor have been adjusted.
##
## 01-01-2002 - 1.0.2 FINAL
##   - Fixed typo in the HOWTO of the preview of the FIRST post
##
## 01-01-2002 - 1.0.3 FINAL
##   - Adjusted (make shorter) the strip_bbcode function in the bbcode.php file
##
## 01-01-2002 - 1.0.4 FINAL
##   - Text with double quotes was not displayed correctly
##
## 01-01-2002 - 1.0.5 FINAL
##   - Added to preview to the search result page (only when viewing topics)
##
## 01-01-2002 - 1.0.6 FINAL
##   - Made phpBB v2.0.2 complaint and EasyMod 0.0.7 complaint
##
## 05-12-2003 - 1.0.7 FINAL
##   - Made phpBB v2.0.6 complaint and EasyMod 0.0.10a complaint
##   - Adjusted to the new Template
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//
// Mouse hover topic preview MOD - BEGIN
//

function bbencode_strip($message, $uid)
{

   $message = strip_tags($message);

   // url #2
   $message = str_replace("[url]","", $message);
   $message = str_replace("[/url]", "", $message);

   // url /\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\](.*?)\[/url\]/si
   $message = preg_replace("/\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\]/si", "", $message);
   $message = str_replace("[/url:$uid]", "", $message);

   $message = preg_replace("/\[.*?:$uid:?.*?\]/si", '', $message);
   $message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
   $message = str_replace('"', "'", $message);
   return $message;

}

//
// Mouse hover topic preview MOD - END
//

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

//
// The following modified by Dauthus to make compliant with PHP-Nuke
//

#
#----[ FIND ]-------------------------------------------
#
$phpbb_root_path = 'modules/Forums/';

#
#----[ AFTER, ADD ]-------------------------------------
#
$phpbb_root_test = '';

#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_test . 'includes/bbcode.'.$phpEx);

//
// End of modification by Dauthus to make compliant with PHP-Nuke
//

#
#-----[ FIND ]------------------------------------------
#
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_last_post_id
      AND p.poster_id = u2.user_id
      AND t.topic_type = " . POST_ANNOUNCE . "

#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, pt.post_text, pt.bbcode_uid
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_last_post_id
      AND p.post_id = pt.post_id
      AND p.poster_id = u2.user_id
      AND t.topic_type = " . POST_ANNOUNCE . "

#
#-----[ FIND ]------------------------------------------
#
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_first_post_id
      AND p2.post_id = t.topic_last_post_id
      AND u2.user_id = p2.poster_id
      AND t.topic_type <> " . POST_ANNOUNCE . "

#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, pt.post_text, pt.bbcode_uid
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_first_post_id
      AND p2.post_id = t.topic_last_post_id
      AND p2.post_id = pt.post_id
      AND u2.user_id = p2.poster_id
      AND t.topic_type <> " . POST_ANNOUNCE . "

#
#-----[ FIND ]------------------------------------------
#
      $topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Mouse hover topic preview MOD - BEGIN
//
      $topic_content = $topic_rowset[$i]['post_text'];
      $bbcode_uid = $topic_rowset[$i]['bbcode_uid'];
      $topic_content = bbencode_strip($topic_content, $bbcode_uid);

      if (strlen($topic_content) > 200)
      {
         $topic_content = substr($topic_content, 0, 200) . "...";
      }
      else
      {
         $topic_content = $topic_content;
      }

//
// Mouse hover topic preview MOD - END
//

#
#-----[ FIND ]------------------------------------------
#
         'TOPIC_TITLE' => $topic_title,


#
#-----[ AFTER, ADD ]------------------------------------------
#
         'TOPIC_CONTENT' => $topic_content,

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewforum_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<td class="row1" width="100%">

#
#-----[ IN-LINE FIND ]------------------------------------------
#
>{topicrow.TOPIC_TITLE}

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
title="{topicrow.TOPIC_CONTENT}"


#
#-----[ OPEN ]------------------------------------------
#
search.php

#
#-----[ FIND ]------------------------------------------
#
         $sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
            FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
            WHERE t.topic_id IN ($search_results)
               AND t.topic_poster = u.user_id
               AND f.forum_id = t.forum_id
               AND p.post_id = t.topic_first_post_id
               AND p2.post_id = t.topic_last_post_id
               AND u2.user_id = p2.poster_id";

#
#-----[ REPLACE WITH ]------------------------------------------
#
         $sql = "SELECT pt.post_text, t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
            FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
            WHERE t.topic_id IN ($search_results)
               AND t.topic_poster = u.user_id
               AND f.forum_id = t.forum_id
               AND pt.post_id = p.post_id
               AND p.post_id = t.topic_first_post_id
               AND p2.post_id = t.topic_last_post_id
               AND u2.user_id = p2.poster_id";

#
#-----[ FIND ]------------------------------------------
#
            $views = $searchset[$i]['topic_views'];
            $replies = $searchset[$i]['topic_replies'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Mouse hover topic preview MOD - BEGIN
//
            $topic_content = $searchset[$i]['post_text'];
            $bbcode_uid = $searchset[$i]['bbcode_uid'];
            $topic_content = bbencode_strip($topic_content, $bbcode_uid);

            if (strlen($topic_content) > 200)
            {
               $topic_content = substr($topic_content, 0, 200) . "...";
            }
            else
            {
               $topic_content = $topic_content;
            }
//
// Mouse hover topic preview MOD - END
//

#
#-----[ FIND ]------------------------------------------
#
         'TOPIC_TITLE' => $topic_title,

#
#-----[ AFTER, ADD ]------------------------------------------
#
         'TOPIC_CONTENT' => $topic_content,

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/search_results_topics.tpl

#
#-----[ FIND ]------------------------------------------
#
<td class="row2"><span class="topictitle">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><br /><span class="gensmall">{searchresults.GOTO_PAGE}</span></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
<td class="row2"><span class="topictitle">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle" title="{searchresults.TOPIC_CONTENT}">{searchresults.TOPIC_TITLE}</a></span><br /><span class="gensmall">{searchresults.GOTO_PAGE}</span></td>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Here is the block for phpnuke I would like to have edited to do the same thing as my forums do..

<?php
########################################################################
# Universal Latest Forums Block                                        #
# ============================================                         #
########################################################################

if (eregi("block-Universalforums.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$HideViewReadOnly = 1;   
$Last_New_Topics  = 5;   
global $prefix, $db, $sitename,$ThemeSel,$bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4,$textcolor1, $textcolor2;
$folder_path = "themes/$ThemeSel/forums/";

if(!is_dir($folder_path))
{
   $folder_path = "themes/$ThemeSel/forums/";
}

$show = "  <tr>
    <td height=\"28\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"".$folder_path."images/cellpic1.gif\">&nbsp;</td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = $db->sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC");
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow($result) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result2 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'");
      list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result2 );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }
   
   if( $topic_moved_id != 0 )
   {

      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;

$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);

$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);

                         $viewlast .="  <tr>
    <td height=\"34\" nowrap bgcolor=\"$bgcolor1\" class=\"row1\"><img src=\"".$folder_path."images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" bgcolor=\"$bgcolor1\" class=\"row1\">&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row3\"><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
    <td align=\"center\" bgcolor=\"$bgcolor1\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap bgcolor=\"$bgcolor1\" class=\"row3\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
      <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"".$folder_path."images/icon_minipost_new.gif\" border=\"0\" alt=\"Latest Post\"></a></td>
  </tr>";
}
   
   if( $Last_New_Topics == $Count_Topics ) { break 1; }
   
}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
  <tr>
    <td bgcolor=\"$bgcolor1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"$bgcolor2\">
        <tr>
          <td><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">
  <tr>
    <th height=\"28\" colspan=\"2\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thcornerl\"><font color=\"$textcolor1\"><strong>Topics</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
    <th width=\"100\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Author&nbsp;</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thtop\"><font color=\"$textcolor1\"><strong>&nbsp;Views&nbsp;</strong></font></th>
    <th align=\"center\" nowrap background=\"".$folder_path."images/cellpic3.gif\" class=\"thcornerr\"><font color=\"$textcolor1\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
  </tr>";
    $content .= "$viewlast";

$content .= "$show";

?>


thank you for helping me..


Back to top Reply with quote
#8   re: Help I need a Forums Topic/Content Preview Block
syruss2125
CZ Newbie
syruss2125 has been a member for over 18 year's 18 Year Member
usa.gif kansas.gif
Gender: Male
Status: Offline
Joined: Nov 08, 2006
0.00 posts per day
Posts: 19
Points: 50
   
I found this one that does what i would like for a block on the front page..

but it's for CPG Nuke dragonfly..
Is there anyway to convert it to PHP Nuke 7.6???



Attached Files
block-New_Forum_Posts.zip (4.22 KB, Downloaded: 5232 Time(s))


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum