phpBB SEO with Top Stats Mod

Discussions and support about the different URL Rewriting techniques for phpBB.

Moderator: Moderators

phpBB SEO with Top Stats Mod

Postby Moogie » Tue Sep 03, 2013 10:55 am

Hi all and thank you for this wonderful mod :)

I've installed the SEO mod, No Dupe & Zero Dupes at my forum (hope it's okay to post a link here so you can see my problem!) - http://www.52fastdiet.co.uk

As you can see, I also use the Top Stats mod, and some of the URLs in the Top Stats boxes are being converted properly:
eg: -http://www.52fastdiet.co.uk/5-2-cookery-f29/carbs-or-no-carbs-t8072.html
while others are just linking to /topicXXXX.html eg:
-http://www.52fastdiet.co.uk/topic8078.html
which then redirects to the correct:
-http://www.52fastdiet.co.uk/5-2-diet-chat-f6/yom-kippur-t8078.html

The links all convert just fine on the 'last post' section of the list of forums as well as within the forums themselves.

Not sure why some of the links on the Top Stats lists are using the proper new URLs and why some are going to /topicXXXX.html and then redirecting properly. I'm sure you'll need some more info from me so please do ask any questions and I'll do my best to give as much info as I can to track this problem down. I really don't want to lose rankings in Google because of these duplicates!

This is the code for the functions_top_stats.php
I'm guessing I just need to change how the URLs are generated here but not sure exactly what needs changing to what. Hope someone can advise! Thank you :)

Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: view_reply.php  2011-08-22 20:19:43 Stoker $
* @copyright (c) 2011 PhpBB3 BBCodes
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

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

/**
* Include only once.
*/
if (!defined('INCLUDES_VIEW_REPLY_PHP'))
{
   define('INCLUDES_VIEW_REPLY_PHP', true);
   
   $flist = $auth->acl_getf('f_read', true);
   $flist = array_unique(array_keys($flist));
   
   
   $max_active = ($user->data[user_id] < 2)  ? 5 : 10;
   
   
   // Recent Active Topics
   $sql = 'SELECT topic_id, forum_id, topic_title, topic_time, topic_views, topic_poster, topic_replies, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, topic_last_poster_id
      FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $flist) . ' AND topic_moved_id = 0 AND topic_status != 1 AND topic_approved = 1
      ORDER BY topic_last_post_id DESC';
   $result = $db->sql_query_limit($sql, $max_active);

   while ($row = $db->sql_fetchrow($result))
   {
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']);
      $view_last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
      $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_poster']);
      $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_last_poster_id']);
      
      $template->assign_block_vars('recent_active', array(
         'TOPIC_TITLE'               => $row['topic_title'],
         'TOPIC_TIME'                    => $user->format_date($row['topic_time']),
         'TOPIC_VIEWS'               => $row['topic_views'],
         'TOPIC_REPLIES'               => $row['topic_replies'],
         'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
         'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
         'TOPIC_LAST_POSTER_NAME'      => $row['topic_last_poster_name'],
         'TOPIC_LAST_POSTER_COLOUR'      => $row['topic_last_poster_colour'],
         'TOPIC_LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
         'TOPIC_LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
         'U_FIRST_TOPIC'               => $view_topic_url,
         'U_LAST_TOPIC'               => $view_last_post_url,
         'USERNAME_FIRST'            => $view_first_poster,
         'USERNAME_LAST'               => $view_last_poster,
      ));
   }
   $db->sql_freeresult($result);
   
   // Most viewed topics   
   $sql = 'SELECT topic_id, forum_id, topic_title, topic_views, topic_time, topic_first_poster_name, topic_first_poster_colour, topic_poster, topic_last_poster_id
   FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $flist) . '
   ORDER BY topic_views DESC';
   $result = $db->sql_query_limit($sql, 8);
   while ($row = $db->sql_fetchrow($result))
   {
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']);
      $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_poster']);
      $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_last_poster_id']);
      
      $template->assign_block_vars('most_viewed', array(
         'TOPIC_ID'                  => $row['topic_id'],
         'FORUM_ID'                   => $row['forum_id'],
         'TOPIC_TITLE'               => $row['topic_title'],
         'TOPIC_VIEWS'               => $row['topic_views'],
         'TOPIC_TIME'                    => $user->format_date($row['topic_time']),
         'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
         'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
         'U_FIRST_TOPIC'               => $view_topic_url,
         'USERNAME_FIRST'            => $view_first_poster,
         'USERNAME_LAST'               => $view_last_poster,
      ));
   }
   $db->sql_freeresult($result);   
   
   // Most replied topics   
   $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_time, topic_first_poster_name, topic_first_poster_colour, topic_poster, topic_last_poster_id
   FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $flist) . '
   ORDER BY topic_replies DESC';
   $result = $db->sql_query_limit($sql, 8);
   while ($row = $db->sql_fetchrow($result))
   {
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']);
      $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_poster']);
      $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&amp;u=' . $row['topic_last_poster_id']);
      
      $template->assign_block_vars('most_replied', array(
         'TOPIC_ID'                  => $row['topic_id'],
         'FORUM_ID'                   => $row['forum_id'],
         'TOPIC_TITLE'               => $row['topic_title'],
         'TOPIC_REPLIES'               => $row['topic_replies'],
         'TOPIC_TIME'                    => $user->format_date($row['topic_time']),
         'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
         'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
         'U_FIRST_TOPIC'               => $view_topic_url,
         'USERNAME_FIRST'            => $view_first_poster,
         'USERNAME_LAST'               => $view_last_poster,
      ));
   }
   $db->sql_freeresult($result);
}
?>
Moogie
 
Posts: 1
Joined: Sat Jul 20, 2013 5:22 pm

Advertisement

Re: phpBB SEO with Top Stats Mod

Postby aagosh82 » Wed Oct 16, 2013 2:57 pm

I am also facing the same issue. It looks like append_sid() function is not doing its job when being called from top_stats php
Could someone please tell what kind of pre-conditions should be there in order to start URL rewriting in append_sid() function?
One of the condition I see is that $phpbb_seo->seo_opt['url_rewrite'] should be true, but how to set it properly ?
aagosh82
 
Posts: 1
Joined: Fri Oct 11, 2013 3:25 pm


Return to phpBB mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 15 guests


 
cron