Fixed phpbbhacks recent posts on index for adv rewrite

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

Moderator: Moderators

Fixed phpbbhacks recent posts on index for adv rewrite

Postby Pigeon » Fri Jan 23, 2009 12:43 am

I have patched the phpbbhacks "Recent posts on index" mod for phpbb2 to work with advanced rewrite.

- The phpbbhacks website calls this mod Recent posts on index revision 1.0.3, but the comments in the code itself call it "Integrated Toplist 1.0.3". It adds a section to the index page listing the five (by default) most recently-replied-to topics.

I couldn't find anything on here about how to patch this mod so I am posting my procedure for the general good :)

These instructions assume you have already applied the advanced rewrite mod and the recent posts on index mod.

Files to edit: index.php

Code: Select all
#
#-----[ OPEN ]------------------------------------------
#

index.php

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

               $topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
               $forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);

#
#-----[ REPLACE WITH ]------------------------------------------
#

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// Following 2 lines moved below
//             $topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
//             $forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);
// www.phpBB-SEO.com SEO TOOLKIT END

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

                $replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']);
                $replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;

#
#-----[ AFTER, ADD ]------------------------------------------
#

               // www.phpBB-SEO.com SEO TOOLKIT BEGIN
               if ( !isset($phpbb_seo->seo_url['forum'][$forum_id]) ) {
                   $phpbb_seo->seo_url['forum'][$rows['forum_id']] = $phpbb_seo->format_url($rows['forum_name'], $php$
               }
               if ( !isset($phpbb_seo->seo_url['topic'][$topic_id]) ) {
                   $phpbb_seo->seo_url['topic'][$rows['topic_id']] = $phpbb_seo->format_url($rows['topic_title'], $ph$
               }

               // Following 2 lines moved from above
               $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $rows['topic_id']);
               $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $rows['forum_id']);
               // www.phpBB-SEO.com SEO TOOLKIT END

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


It's only the viewforum and viewtopic URLs that need attention. The member profile and last post URLs it magically gets right anyway without need for any patching.

This works on my forum but it would be appreciated if someone could verify it... Not used to PHP, it's too high level and it melts my brain :) C is more my scene...
Pigeon
 
Posts: 17
Joined: Sun Jan 18, 2009 10:36 pm

Advertisement

Postby SeO » Fri Jan 23, 2009 4:17 pm

Well done, thanks for sharing ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm


Return to phpBB2 Advanced mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 7 guests