display topics on external page

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

Moderator: Moderators

display topics on external page

Postby nasht00 » Thu Oct 22, 2009 1:37 am

I want to use a script similar to this:
http://wiki.phpbb.com/Practical.Display ... rnal_pages

To show my latest topics somewhere else.
How can I make sure they use the correct URLs?
I'm using the Advanced mode.

Thanks

Nathan
Last edited by dcz on Thu May 05, 2011 12:12 pm, edited 2 times in total.
Reason: Updated the phpBB wiki link
nasht00
 
Posts: 21
Joined: Thu Oct 01, 2009 10:29 pm

Advertisement

Re: display topics on external page

Postby dcz » Sun Oct 25, 2009 12:57 pm

For all url rewriting types, the solution will be to add :
Code: Select all
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        if (!empty($topics_row['topic_url'])) {
            $phpbb_seo->prepare_iurl($topics_row, 'topic', '');
        } else {
            if ($phpbb_seo->modrtype > 2) {
                $topics_row['topic_title'] = censor_text($topics_row['topic_title']);
            }
            $cur_forum_id = (int) $topics_row['forum_id'];
            $parent_forum = $topics_row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : (!empty($phpbb_seo->seo_url['forum'][$cur_forum_id]) ? $phpbb_seo->seo_url['forum'][$cur_forum_id] : false);
            if ($parent_forum) {
                $phpbb_seo->prepare_iurl($topics_row, 'topic', $parent_forum);
            }
        }
        // www.phpBB-SEO.com SEO TOOLKIT END   

After :
Code: Select all
      while( $topics_row = $db->sql_fetchrow($topics_result) )
      { 

for the topic list way, or :
Code: Select all
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        if (!empty($posts_row['topic_url'])) {
            $phpbb_seo->prepare_iurl($posts_row, 'topic', '');
        } else {
            if ($phpbb_seo->modrtype > 2) {
                $posts_row['topic_title'] = censor_text($posts_row['topic_title']);
            }
            $cur_forum_id = (int) $posts_row['forum_id'];
            $parent_forum = $posts_row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : (!empty($phpbb_seo->seo_url['forum'][$cur_forum_id]) ? $phpbb_seo->seo_url['forum'][$cur_forum_id] : false);
            if ($parent_forum) {
                $phpbb_seo->prepare_iurl($posts_row, 'topic', $parent_forum);
            }
        }
        // www.phpBB-SEO.com SEO TOOLKIT END   

After :
Code: Select all
      while( $posts_row = $db->sql_fetchrow($posts_result) )
      { 

if you'll be using the post display way.

Note that this will work as is if you are using the last version of the script form the phpBB wiki, here is the change history I just performed (since it was supposed to be like this in phpBB) :http://wiki.phpbb.com/index.php?title=Displaying_posts_and_topics_on_external_pages&diff=4410&oldid=4407

;)
Last edited by SeO on Thu Nov 04, 2010 10:49 am, edited 1 time in total.
Reason: phpBB wiki link is not available anymore, but, the code should still work
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: 21429
Joined: Fri Apr 28, 2006 9:03 pm

Re: display topics on external page

Postby scworldnetter » Fri Apr 08, 2011 5:40 am

What's the proper way of initializing $phpbb_seo? If it's not properly initialized in the external PhP script, one gets the error

Fatal error: Call to a member function prepare_iurl() on a non-object in index.php on line 415, which is

Code: Select all
              if (!empty($last_topics_row['topic_url'])) {
                  $phpbb_seo->prepare_iurl($last_topics_row, 'topic', '');






Thanks.
scworldnetter
 
Posts: 17
Joined: Mon Mar 14, 2011 1:11 am

Re: display topics on external page

Postby scworldnetter » Fri Apr 08, 2011 3:17 pm

Answered my own question, since I am writing some functions inside a class, I had to use

Code: Select all
   global $phpbb_seo;


This might be useful for anyone else coding additional pages or mods that use classes and functions as opposed to doing everything in the main page script.
scworldnetter
 
Posts: 17
Joined: Mon Mar 14, 2011 1:11 am

Re: display topics on external page

Postby philgreen » Wed Jan 30, 2013 12:09 am

Thanks a lot for doing this! My only question is the gzip. I'm trying to use this on an external page that has gzip turned on. As it is I get a warning

"Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in" etc
philgreen
 
Posts: 9
Joined: Thu Aug 16, 2012 6:14 pm


Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 12 guests