Problem with NV Recent Post

phpBB3 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting forums and topic titles in their URLs.

Moderator: Moderators

Problem with NV Recent Post

Postby Tricfire » Thu Mar 06, 2008 11:24 pm

First, forgive my English.

I have a problem with the mod NV Recents Post, since I am not working in the SEO links that panel. How can I fix it?

Thanks.
Tricfire
 
Posts: 20
Joined: Thu Mar 06, 2008 11:20 pm

Advertisement

Postby HB » Sat Mar 08, 2008 3:58 am

I'm not familiar with that MOD, but here's a quick hack I wrote once for displaying the list of public recent topics. The same code for setting up the URLs below are probably very close the one in your mod.

Code: Select all
<html>
<body>

<?php

// recent topics "lite" - modify configuration variable below
$public_forums = "1,2,3,4"; // list of public forums

// usual initialization variables
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$sql = "SELECT DISTINCT(t.topic_id), t.forum_id, t.topic_title, t.topic_last_post_id, t.topic_status, t.topic_replies, t.topic_replies_real, t.topic_type, f.forum_name
   FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
   WHERE t.forum_id IN ($public_forums)
   AND t.topic_status <> 2
   AND t.forum_id = f.forum_id
   ORDER BY t.topic_last_post_id DESC LIMIT 10";    
$result = $db->sql_query($sql);

$line = array();
while( $row = $db->sql_fetchrow($result)) {
   $line[] = $row;
}
$db->sql_freeresult($result);

for( $i = 0; $i < count($line); $i++ )
{
   $forum_name = $line[$i]['forum_name'];
   $topic_id = $line[$i]['topic_id'];
   $forum_id = $line[$i]['forum_id'];
   $post_id = $line[$i]['topic_last_post_id'];
   $topic_title = censor_text($line[$i]['topic_title']);
   
   $replies = ($auth->acl_get('m_approve', $forum_id)) ? $line[$i]['topic_replies_real'] : $line[$i]['topic_replies'];   
   $start = floor(($replies) / $config['posts_per_page']) * $config['posts_per_page'];
         
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($line[$i]['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = $topic_title;
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END   
   
   $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id . '&amp;f=' . $forum_id . '&amp;start=' . $start ) . '#p' . $post_id;
   $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;start=$start");        

   echo '<a href="' . $post_url . '">recent post</a> to &quot;';      
   echo '<a href="'. $topic_url .'">'. $topic_title .'</a>&quot;<br/>';
}

?>

</body>
</html>
Dan Kehn
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1504
Joined: Mon Oct 16, 2006 2:25 am

Postby Tricfire » Sat Mar 08, 2008 9:29 pm

Solved. Thanks. 8)
Tricfire
 
Posts: 20
Joined: Thu Mar 06, 2008 11:20 pm

how can we use your code

Postby sansar » Sun Mar 16, 2008 11:05 am

hi, i have the same problem. how can we use your code?
User avatar
sansar
 
Posts: 16
Joined: Sun Mar 16, 2008 10:40 am

Postby sansar » Mon Mar 17, 2008 5:02 pm

my "functions_recenttopics.php" file is like under. i think i must edit this file but how?

Code: Select all
<?php

/**
*
* @package - NV recent topics
* @version $Id: functions_recenttopics.php 68 2008-01-06 01:03:56Z nickvergessen $
* @copyright (c) nickvergessen ( http://mods.flying-bits.org/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

//we run it and display it on this page, go on...
//get some files and data
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$user->add_lang('mods/info_acp_recenttopics');
$user_id = $user->data['user_id'];
$limit = $config['rt_number'];

$template->assign_vars(array(
   'RT_DISPLAY'      => true,
   'NEWEST_POST_IMG'         => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
));

$rt_anti_topics = '0';
$rt_anti_topics = $config['rt_anti_topics'];
$onlyforum = 0;
$onlyforum = request_var('f', 0);
$sql = 'SELECT * FROM ' . FORUMS_TABLE . "
   ORDER BY left_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
   if (strstr($onlyforum, $row['parent_id']))
   {
      $onlyforum .= ', ' . $row['forum_id'];
   }
}
$db->sql_freeresult($result);
$forum_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
   if ($allowed['f_read'])
   {
      $forum_ary[] = (int) $forum_id;
   }
}
$forum_ary = array_unique($forum_ary);
$forum_sql = (sizeof($forum_ary)) ? $db->sql_in_set('t.forum_id', $forum_ary, false) : $db->sql_in_set('t.forum_id', '0', false);

$keeponrunning = $topic_id = 0;

$sql = 'SELECT t.*, i.icons_url, i.icons_width, i.icons_height, tp.topic_posted, f.forum_name, f.forum_type, f.forum_flags
   FROM ' . TOPICS_TABLE . ' t
   LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp
      ON (t.topic_id = tp.topic_id
         AND tp.user_id = ' . $user_id . ')
   LEFT JOIN ' . FORUMS_TABLE . ' f
      ON f.forum_id = t.forum_id
   LEFT JOIN ' . ICONS_TABLE . ' i
      ON t.icon_id = i.icons_id
   WHERE
      (
         f.forum_recent_topics = 1
         ' . (($onlyforum) ? ' AND f.forum_id IN (' . $onlyforum . ')': '') . "
         " . (($rt_anti_topics) ? ' AND t.topic_id not IN (' . $rt_anti_topics . ')': '') . "
         AND $forum_sql
      )
      OR t.topic_type IN (" . POST_GLOBAL . ")
   GROUP BY t.topic_last_post_id
   ORDER BY t.topic_last_post_time DESC
   LIMIT $limit";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
   $topic_id = $row['topic_id'];
   $forum_id = $row['forum_id'];
   $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
   $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
   $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
   $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
   $folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
   switch ($row['topic_type'])
   {
      case POST_GLOBAL:
         $topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
         $folder = 'global_read';
         $folder_new = 'global_unread';
      break;
      case POST_ANNOUNCE:
         $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
         $folder = 'announce_read';
         $folder_new = 'announce_unread';
      break;
      case POST_STICKY:
         $topic_type = $user->lang['VIEW_TOPIC_STICKY'];
         $folder = 'sticky_read';
         $folder_new = 'sticky_unread';
      break;
      default:
         $topic_type = '';
         $folder = 'topic_read';
         $folder_new = 'topic_unread';
         if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $row['topic_status'] != ITEM_LOCKED)
         {
            $folder .= '_hot';
            $folder_new .= '_hot';
         }
      break;
   }
   if ($row['topic_status'] == ITEM_LOCKED)
   {
      $topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
      $folder .= '_locked';
      $folder_new .= '_locked';
   }
   if ($row['topic_posted'])
   {
      $folder .= '_mine';
      $folder_new .= '_mine';
   }
   if ($row['topic_type'] == POST_GLOBAL)
   {
      $global_announce_list[$row['topic_id']] = true;
   }
   $folder_img = ($unread_topic) ? $folder_new : $folder;
   $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
   if ($row['poll_start'] && $row['topic_status'] != ITEM_MOVED)
   {
      $topic_type = $user->lang['VIEW_TOPIC_POLL'];
   }
   $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
   $view_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
   $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
   $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
   $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$topic_id", true, $user->session_id) : '';
   $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
   $template->assign_block_vars('recenttopicrow', array(
      'FORUM_ID'               => $forum_id,
      'TOPIC_ID'               => $topic_id,
      'TOPIC_AUTHOR_FULL'         => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
      'FIRST_POST_TIME'         => $user->format_date($row['topic_time']),
      'LAST_POST_SUBJECT'         => censor_text($row['topic_last_post_subject']),
      'LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
      'LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
      'LAST_POST_AUTHOR'         => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'LAST_POST_AUTHOR_COLOUR'   => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'LAST_POST_AUTHOR_FULL'      => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'PAGINATION'      => topic_generate_pagination($replies, $view_topic_url),
      'REPLIES'         => $replies,
      'VIEWS'            => $row['topic_views'],
      'TOPIC_TITLE'      => censor_text($row['topic_title']),
      'FORUM_NAME'      => $row['forum_name'],
      'TOPIC_TYPE'      => $topic_type,
      'TOPIC_FOLDER_IMG'      => $user->img($folder_img, $folder_alt),
      'TOPIC_FOLDER_IMG_SRC'   => $user->img($folder_img, $folder_alt, false, '', 'src'),
      'TOPIC_FOLDER_IMG_ALT'   => $user->lang[$folder_alt],
      'NEWEST_POST_IMG'      => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
      'TOPIC_ICON_IMG'      => (!empty($row['icons_url'])) ? $row['icons_url'] : '',
      'TOPIC_ICON_IMG_WIDTH'   => (!empty($row['icons_url'])) ? $row['icons_width'] : '',
      'TOPIC_ICON_IMG_HEIGHT'   => (!empty($row['icons_url'])) ? $row['icons_height'] : '',
      'ATTACH_ICON_IMG'      => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
      'UNAPPROVED_IMG'      => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
      'S_TOPIC_TYPE'         => $row['topic_type'],
      'S_USER_POSTED'         => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
      'S_UNREAD_TOPIC'      => $unread_topic,
      'S_TOPIC_REPORTED'      => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
      'S_TOPIC_UNAPPROVED'   => $topic_unapproved,
      'S_POSTS_UNAPPROVED'   => $posts_unapproved,
      'S_HAS_POLL'         => ($row['poll_start']) ? true : false,
      'S_POST_ANNOUNCE'      => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
      'S_POST_GLOBAL'         => ($row['topic_type'] == POST_GLOBAL) ? true : false,
      'S_POST_STICKY'         => ($row['topic_type'] == POST_STICKY) ? true : false,
      'S_TOPIC_LOCKED'      => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
      'S_TOPIC_MOVED'         => ($row['topic_status'] == ITEM_MOVED) ? true : false,
      'U_NEWEST_POST'         => $view_topic_url . '&amp;view=unread#unread',
      'U_LAST_POST'         => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
      'U_LAST_POST_AUTHOR'   => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'U_TOPIC_AUTHOR'      => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
      'U_VIEW_TOPIC'         => $view_topic_url,
      'U_VIEW_FORUM'         => $view_forum_url,
      'U_MCP_REPORT'         => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;f=' . $forum_id . '&amp;t=' . $topic_id, true, $user->session_id),
      'U_MCP_QUEUE'         => $u_mcp_queue,
      'S_TOPIC_TYPE_SWITCH'   => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
   ));
}
$db->sql_freeresult($result);

?>
User avatar
sansar
 
Posts: 16
Joined: Sun Mar 16, 2008 10:40 am

Postby Tricfire » Wed Mar 19, 2008 1:23 am

It's my "functions_recenttopics.php"


Code: Select all
<?php

/**
*
* @package - NV recent topics
* @version $Id: functions_recenttopics.php 68 2008-01-06 01:03:56Z nickvergessen $
* @copyright (c) nickvergessen ( http://mods.flying-bits.org/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

//we run it and display it on this page, go on...
//get some files and data
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$user->add_lang('mods/info_acp_recenttopics');
$user_id = $user->data['user_id'];
$limit = $config['rt_number'];

$template->assign_vars(array(
   'RT_DISPLAY'      => true,
   'NEWEST_POST_IMG'         => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
));

$rt_anti_topics = '0';
$rt_anti_topics = $config['rt_anti_topics'];
$onlyforum = 0;
$onlyforum = request_var('f', 0);
$sql = 'SELECT * FROM ' . FORUMS_TABLE . "
   ORDER BY left_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
   if (strstr($onlyforum, $row['parent_id']))
   {
      $onlyforum .= ', ' . $row['forum_id'];
   }
}
$db->sql_freeresult($result);
$forum_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
   if ($allowed['f_read'])
   {
      $forum_ary[] = (int) $forum_id;
   }
}
$forum_ary = array_unique($forum_ary);
$forum_sql = (sizeof($forum_ary)) ? $db->sql_in_set('t.forum_id', $forum_ary, false) : $db->sql_in_set('t.forum_id', '0', false);

$keeponrunning = $topic_id = 0;

$sql = 'SELECT t.*, i.icons_url, i.icons_width, i.icons_height, tp.topic_posted, f.forum_name, f.forum_type, f.forum_flags
   FROM ' . TOPICS_TABLE . ' t
   LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp
      ON (t.topic_id = tp.topic_id
         AND tp.user_id = ' . $user_id . ')
   LEFT JOIN ' . FORUMS_TABLE . ' f
      ON f.forum_id = t.forum_id
   LEFT JOIN ' . ICONS_TABLE . ' i
      ON t.icon_id = i.icons_id
   WHERE
      (
         f.forum_recent_topics = 1
         ' . (($onlyforum) ? ' AND f.forum_id IN (' . $onlyforum . ')': '') . "
         " . (($rt_anti_topics) ? ' AND t.topic_id not IN (' . $rt_anti_topics . ')': '') . "
         AND $forum_sql
      )
      OR t.topic_type IN (" . POST_GLOBAL . ")
   GROUP BY t.topic_last_post_id
   ORDER BY t.topic_last_post_time DESC
   LIMIT $limit";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
   $topic_id = $row['topic_id'];
   $forum_id = $row['forum_id'];
   $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
   $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
   $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
   $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
   $folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
   switch ($row['topic_type'])
   {
      case POST_GLOBAL:
         $topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
         $folder = 'global_read';
         $folder_new = 'global_unread';
      break;
      case POST_ANNOUNCE:
         $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
         $folder = 'announce_read';
         $folder_new = 'announce_unread';
      break;
      case POST_STICKY:
         $topic_type = $user->lang['VIEW_TOPIC_STICKY'];
         $folder = 'sticky_read';
         $folder_new = 'sticky_unread';
      break;
      default:
         $topic_type = '';
         $folder = 'topic_read';
         $folder_new = 'topic_unread';
         if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $row['topic_status'] != ITEM_LOCKED)
         {
            $folder .= '_hot';
            $folder_new .= '_hot';
         }
      break;
   }
   if ($row['topic_status'] == ITEM_LOCKED)
   {
      $topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
      $folder .= '_locked';
      $folder_new .= '_locked';
   }
   if ($row['topic_posted'])
   {
      $folder .= '_mine';
      $folder_new .= '_mine';
   }
   if ($row['topic_type'] == POST_GLOBAL)
   {
      $global_announce_list[$row['topic_id']] = true;
   }
   $folder_img = ($unread_topic) ? $folder_new : $folder;
   $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($line[$i]['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = $topic_title;
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END
   if ($row['poll_start'] && $row['topic_status'] != ITEM_MOVED)
   {
      $topic_type = $user->lang['VIEW_TOPIC_POLL'];
   }
   $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
   $view_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
   $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
   $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
   $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$topic_id", true, $user->session_id) : '';
   $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
   $template->assign_block_vars('recenttopicrow', array(
      'FORUM_ID'               => $forum_id,
      'TOPIC_ID'               => $topic_id,
      'TOPIC_AUTHOR_FULL'         => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
      'FIRST_POST_TIME'         => $user->format_date($row['topic_time']),
      'LAST_POST_SUBJECT'         => censor_text($row['topic_last_post_subject']),
      'LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
      'LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
      'LAST_POST_AUTHOR'         => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'LAST_POST_AUTHOR_COLOUR'   => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'LAST_POST_AUTHOR_FULL'      => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'PAGINATION'      => topic_generate_pagination($replies, $view_topic_url),
      'REPLIES'         => $replies,
      'VIEWS'            => $row['topic_views'],
      'TOPIC_TITLE'      => censor_text($row['topic_title']),
      'FORUM_NAME'      => $row['forum_name'],
      'TOPIC_TYPE'      => $topic_type,
      'TOPIC_FOLDER_IMG'      => $user->img($folder_img, $folder_alt),
      'TOPIC_FOLDER_IMG_SRC'   => $user->img($folder_img, $folder_alt, false, '', 'src'),
      'TOPIC_FOLDER_IMG_ALT'   => $user->lang[$folder_alt],
      'NEWEST_POST_IMG'      => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
      'TOPIC_ICON_IMG'      => (!empty($row['icons_url'])) ? $row['icons_url'] : '',
      'TOPIC_ICON_IMG_WIDTH'   => (!empty($row['icons_url'])) ? $row['icons_width'] : '',
      'TOPIC_ICON_IMG_HEIGHT'   => (!empty($row['icons_url'])) ? $row['icons_height'] : '',
      'ATTACH_ICON_IMG'      => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
      'UNAPPROVED_IMG'      => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
      'S_TOPIC_TYPE'         => $row['topic_type'],
      'S_USER_POSTED'         => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
      'S_UNREAD_TOPIC'      => $unread_topic,
      'S_TOPIC_REPORTED'      => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
      'S_TOPIC_UNAPPROVED'   => $topic_unapproved,
      'S_POSTS_UNAPPROVED'   => $posts_unapproved,
      'S_HAS_POLL'         => ($row['poll_start']) ? true : false,
      'S_POST_ANNOUNCE'      => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
      'S_POST_GLOBAL'         => ($row['topic_type'] == POST_GLOBAL) ? true : false,
      'S_POST_STICKY'         => ($row['topic_type'] == POST_STICKY) ? true : false,
      'S_TOPIC_LOCKED'      => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
      'S_TOPIC_MOVED'         => ($row['topic_status'] == ITEM_MOVED) ? true : false,
      'U_NEWEST_POST'         => $view_topic_url . '&amp;view=unread#unread',
      'U_LAST_POST'         => $view_topic_url . '#p' . $row['topic_last_post_id'],
      'U_LAST_POST_AUTHOR'   => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
      'U_TOPIC_AUTHOR'      => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
      'U_VIEW_TOPIC'         => $view_topic_url,
      'U_VIEW_FORUM'         => $view_forum_url,
      'U_MCP_REPORT'         => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;f=' . $forum_id . '&amp;t=' . $topic_id, true, $user->session_id),
      'U_MCP_QUEUE'         => $u_mcp_queue,
      'S_TOPIC_TYPE_SWITCH'   => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
   ));
}
   
$db->sql_freeresult($result);

?>
Tricfire
 
Posts: 20
Joined: Thu Mar 06, 2008 11:20 pm

Postby dcz » Sun Mar 23, 2008 5:05 pm

Try replacing :
Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($line[$i]['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = $topic_title;
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END


with :

Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($row['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url(censor_text($row['topic_title']));
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END


In the last file you posted, and please remember next time that posting a lot of code is not handy to read, it's better to post a link to a zip archive containing your files.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21325
Joined: Fri Apr 28, 2006 9:03 pm

Postby Blogster » Sat Apr 05, 2008 10:41 am

Hi,
ig got the same problem but with the phpbb3portal from phpbb3portal.com here is my recent.php
Hope u can help me out:

Code: Select all
<?php
/*
*
* @name recent.php
* @package phpBB3 Portal  a.k.a canverPortal
* @version $Id: recent.php,v 1.5 2007/04/14 02:05:16 angelside Exp $
* @copyright (c) Canver Software - www.canversoft.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
   exit;
}


/**
*/

//
// Exclude forums
//
$sql_where = '';
if ($CFG['exclude_forums'])
{
   $exclude_forums = explode(',', $CFG['exclude_forums']);
   foreach ($exclude_forums as $i => $id)
   {
      if ($id > 0)
      {
         $sql_where .= ' AND forum_id != ' . trim($id);
      }
   }
}

//
// Recent announcements
//
$sql = 'SELECT topic_title, forum_id, topic_id
   FROM ' . TOPICS_TABLE . '
   WHERE topic_status <> 2
      AND topic_approved = 1
      AND ( topic_type = 2 OR topic_type = 3 )
      ' . $sql_where . '
   ORDER BY topic_time DESC';

$result = $db->sql_query_limit($sql, $CFG['max_topics']);

while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title'] != '') )
{
   // auto auth
   if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
   {
      $template->assign_block_vars('latest_announcements', array(
         'TITLE'          => character_limit($row['topic_title'], $CFG['recent_title_limit']),
         'FULL_TITLE'   => censor_text($row['topic_title']),
         'U_VIEW_TOPIC'   => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'])
         )
      );
   }
}
$db->sql_freeresult($result);

//
// Recent hot topics
//
$sql = 'SELECT topic_title, forum_id, topic_id
   FROM ' . TOPICS_TABLE . '
   WHERE topic_approved = 1
      AND topic_replies >=' . $config['hot_threshold'] . '
      ' . $sql_where . '
   ORDER BY topic_time DESC';

$result = $db->sql_query_limit($sql, $CFG['max_topics']);

while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title'] != '') )
{
   // auto auth
   if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
   {
      $template->assign_block_vars('latest_hot_topics', array(
         'TITLE'          => character_limit($row['topic_title'], $CFG['recent_title_limit']),
         'FULL_TITLE'   => censor_text($row['topic_title']),
         'U_VIEW_TOPIC'   => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'])
         )
      );
   }
}
$db->sql_freeresult($result);

//
// Recent topic (only show normal topic)
//
$sql = 'SELECT topic_title, forum_id, topic_id
   FROM ' . TOPICS_TABLE . '
   WHERE topic_status <> 2
      AND topic_approved = 1
      AND topic_type = 0
      ' . $sql_where . '
   ORDER BY topic_time DESC';

$result = $db->sql_query_limit($sql, $CFG['max_topics']);

while( ($row = $db->sql_fetchrow($result)) && ($row['topic_title'] != '') )
{
   // auto auth
   if ( ($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0') )
   {
      $template->assign_block_vars('latest_topics', array(
         'TITLE'          => character_limit($row['topic_title'], $CFG['recent_title_limit']),
         'FULL_TITLE'   => censor_text($row['topic_title']),
         'U_VIEW_TOPIC'   => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'])
         )
      );
   }   
}
$db->sql_freeresult($result);

?>



I will Donate u via paypal 15 USD.
No Joke ;)
Blogster
 
Posts: 1
Joined: Tue Jan 29, 2008 9:40 pm

Postby sansar » Sat Apr 05, 2008 10:57 am

hi, i have the same error. I replaced Tricfire's "functions_recenttopics.php" file with my own file and edited with dcz suggest, its not still well. Some topics ok but someones viewtopic.php..

I added my final functions_recenttopics.php file. Where is the problem?
User avatar
sansar
 
Posts: 16
Joined: Sun Mar 16, 2008 10:40 am

Postby sansar » Sat Apr 12, 2008 8:30 am

any solution?
User avatar
sansar
 
Posts: 16
Joined: Sun Mar 16, 2008 10:40 am

Postby Rick_M71 » Sun Apr 13, 2008 11:43 pm

I installed the mod following the directions exactly and it worked perfectly except (as expected) some of the thread links were not SEO'd, but it did show on the index page the 5 most recent threads with working links.

Sansar - before you tried the new functions_recenttopics.php did your mod work? If not, then I'm guessing you made a mistake somewhere along the lines of installing the mod.

After I installed the mod, I uploaded the code that by Tricfire and it appears to work perfectly.

Thanks to NV for the mod, and people here for getting it to work with phpbb-seo - it's exactly what I've been waiting for!
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Postby Rick_M71 » Sun Apr 13, 2008 11:47 pm

I stand corrected - when I looked a bit closer, some of the URL's are:

-http://www.mysite.com/forum/topic-t9.html

instead of:

-http://www.mysite.com/forum/welcome-the-forum-t9.html

But some of the other links are fine.

Any ideas?
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Postby Rick_M71 » Mon Apr 14, 2008 12:00 am

Okay - did the modification listed by dcz and it works perfectly now. Awesome!
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Postby SeO » Mon Apr 14, 2008 12:01 am

About the portal, please start a new topic if there is not one for it already (try searching ;)).

@Rick_M71
Are these links (the one without title) from the same output ?

Did you do this in functions_recentopics.php :
add :
Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($row['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url(censor_text($row['topic_title']));
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END

After :
Code: Select all
   $topic_id = $row['topic_id'];
   $forum_id = $row['forum_id'];
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby camaleon123 » Wed Apr 23, 2008 3:25 am

What should i add to show the categories ?
camaleon123
 
Posts: 9
Joined: Sat Apr 19, 2008 7:33 pm

Next

Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests