IM Portal rewrite

To talk about mods and code.
Patches requests, solutions and SEO tweaks sharing.

Moderator: Moderators


IM Portal rewrite

Postby coyote » Tue Sep 18, 2007 3:02 pm

As I stated in a different post, I am looking for a way to use IM Portal's multiple portal page feature to create an "about" page, a "contact" page, etc. I think I even understand how to rewrite a specific URL for each portal page, or at least I have a start on it...

RewriteRule ^about([0-9]+)\.html$ /portal.php?page=2 [QSA,L,NC]

RewriteRule ^contact([0-9]+)\.html$ /portal.php?page=3 [QSA,L,NC]


My next question is, I see only one spot to assign a page title in portal.php.
Code: Select all
//
// Start output of page
//
$page_title = $lang['Home'];


I don't think it would be good from an SEO point of view to have 5 or 6 pages with the same title (or does that matter?). It might also be confusing to the users. How can portal.php have a different title than portal.php?page=2?
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Advertisement

Postby dcz » Thu Sep 20, 2007 8:11 am

Yes, all pages should have a different title.

Could you post a link to the IM portal release thread (the official one) ?

++
dcz
Administrateur - Site Admin
Administrateur - Site Admin
 
Posts: 17678
Joined: Fri Apr 28, 2006 9:03 pm

Postby coyote » Thu Sep 20, 2007 3:20 pm

I was going to give you the download link straight from IntegraMOD, but it seems they have recently redone their site and they're no longer offering IM Portal for download.

So here is the link on phpbbhacks.com.

http://phpbbhacks.com/download/2779
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby dcz » Fri Sep 21, 2007 9:50 am

All right.
So this won't be a perfect one for articles, since the portal does not have a proper URL structure.

The article=0 link will always lead to the last news, where it should logically lead to the same article for ever.
This comes from the fact the portal does not use the source topic id as id, but rather the order of the current new list.
It would require quite some changes to fix this.

But, for the pages themselves, as well as for the links to the forums outputted on the portal, here is what to do :

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

portal.php

#
#-----[ FIND ]------------------------------------------
#
   $sql = "SELECT template, forum_wide, view, groups FROM " . LAYOUT_TABLE . " WHERE lid = '" . $layout . "'";

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   $sql = "SELECT name, template, forum_wide, view, groups FROM " . LAYOUT_TABLE . " WHERE lid = '" . $layout . "'";
   // www.phpBB-SEO.com SEO TOOLKIT END


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

      $sql = "SELECT template, forum_wide FROM " . LAYOUT_TABLE . " WHERE lid = '" . $layout . "'";

#
#-----[ REPLACE WITH ]------------------------------------------
#
      
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      $sql = "SELECT name, template, forum_wide FROM " . LAYOUT_TABLE . " WHERE lid = '" . $layout . "'";
      // www.phpBB-SEO.com SEO TOOLKIT END

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

   $layout_template = $layout_row['template'];
   $layout_forum_wide_flag = ($layout_row['forum_wide']) ? FALSE : TRUE;
}

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

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( !isset($phpbb_seo->seo_url['portal_page'][$layout]) ) {
   $phpbb_seo->seo_url['portal_page'][$layout] = $phpbb_seo->format_url($layout_row['name'], $phpbb_seo->seo_static['portal_page']);
}
// www.phpBB-SEO.com SEO TOOLKIT END

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

$page_title = $lang['Home'];

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

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$page_title = !empty($layout_row['name']) ? $layout_row['name'] : $lang['Home'];
// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ OPEN ]------------------------------------------
#

fetchposts.php

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

function phpbb_fetch_posts($forum_sql, $number_of_posts, $text_length)
{
   global $db, $board_config;

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpbb_seo;
   // www.phpBB-SEO.com SEO TOOLKIT END

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

         $posts[$i]['post_text'] = nl2br($posts[$i]['post_text']);
         $i++;

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         if ( !isset($phpbb_seo->seo_url['topic'][$row['topic_id']]) ) {
            $phpbb_seo->seo_url['topic'][$row['topic_id']] = $phpbb_seo->format_url($row['topic_title']);
         }
         // www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ OPEN ]------------------------------------------
#

phpbb_seo/phpbb_seo_class.php

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

      // Stop vars
      $this->seo_stop_vars = array("view=", "mark=");

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

      // IM portal
      $this->seo_path['portal_url'] = $this->seo_path['phpbb_url'];
      $this->seo_delim['portal_page'] = '-p';
      $this->seo_ext['portal_page'] = '.html';
      $this->seo_static['portal_index'] = 'portal';
      $this->seo_ext['portal_index'] = '.html';
      $this->seo_url['portal_page'] = array();

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

}
?>

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

   /**
   * URL rewritting for portal.php
   * @access private
   */
   function portal() {
      if ( !empty($this->get_vars['page']) && !empty($this->seo_url['portal_page'][$this->get_vars['page']]) ) {
         $this->url = $this->seo_url['portal_page'][$this->get_vars['page']] . $this->seo_delim['portal_page'] . $this->get_vars['page'] . $this->seo_ext['portal_page'];
         unset($this->get_vars['page']);
      } elseif (empty($this->get_vars)) {
         $this->url = $this->seo_static['portal_index'] . $this->seo_ext['portal_index'];
      }
      return;
   }

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


I did not find any auto menu, so I don't know where the portal.php?page=xx links are outputed, but if you call :

Code: Select all
append_sid(portal.php?page=xx);


in portal.php, the link will be rewritten to :

Code: Select all
page-tite-pxx.html


And :

Code: Select all
append_sid(portal.php);


To :

Code: Select all
portal.html



You will need to add this rewriterule in you forum's .htaccess :

Code: Select all
# PORTAL INDEX
RewriteRule ^portal\.html$ /portal.php [QSA,L,NC]
# PORTAL PAGES
RewriteRule ^[a-z0-9_-]+-p([0-9]+)\.html$ /portal.php?page=$1 [QSA,L,NC] 


With the proper paths obviously.

The page titles will be the one set for every pages in ACP, the url will use it as well.

++
dcz
Administrateur - Site Admin
Administrateur - Site Admin
 
Posts: 17678
Joined: Fri Apr 28, 2006 9:03 pm

Postby coyote » Fri Sep 21, 2007 2:26 pm

Oh wow, dcz, how am I going to thank you for this? You've really gone out of your way here. Merci! :)

I'll try it later tonight or this weekend and let you know how it goes.
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby dcz » Mon Sep 24, 2007 10:11 am

So how is it going ?

;)
dcz
Administrateur - Site Admin
Administrateur - Site Admin
 
Posts: 17678
Joined: Fri Apr 28, 2006 9:03 pm

Postby coyote » Mon Sep 24, 2007 2:15 pm

This is just a test server. I don't have the portal pages rewritten yet, but I did change index.php to forums.php and was able to successfully rewrite the URL. Mostly I've been spending my time getting everything to work with someone else's 730 pixel design.

-www.common-nation.com

This link is probably only good for about a week or so.

P.S. Apologies for removing the footer link. The client asked me to get rid of all links except the Kinnarees Digital Media. :oops: I will make it up to you somehow....
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby dcz » Thu Sep 27, 2007 8:42 am

As said, the portal is not building any portal link by default, but the code change above should make it as easy as a call to append_sid().

About the link in footer, well, it's a licence requirement, but there are few words about possible exceptions in the install, looks like you're in the case where you should prove a submission to a decent directory per install, if you really cannot add at least a copyright page on the site.

++
dcz
Administrateur - Site Admin
Administrateur - Site Admin
 
Posts: 17678
Joined: Fri Apr 28, 2006 9:03 pm

Postby coyote » Thu Sep 27, 2007 3:15 pm

I will try to convince the client to let me put in the phpBB SEO link, and failing that, I'll try to find a good directory that you're not already listed in.
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby coyote » Thu Sep 27, 2007 6:07 pm

I put the link back in the footer; let's see if the client even notices. If they do, I'll tell them it has to be there unless they want to pay for a directory submission. I'm sure they'll be OK with it if I put it like that. ;)
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby coyote » Fri Oct 12, 2007 2:37 am

OK, I've finally had a chance to fool around with this, and it's working pretty good except for a couple things.

I put these lines in the page_header:

'U_ABOUT' => append_sid('portal.'.$phpEx.'?page=2'),
'U_CONTACT' => append_sid('portal.'.$phpEx.'?page=3'),
'U_DOWNLOAD' => append_sid('portal.'.$phpEx.'?page=4'),
'U_FORUMS' => append_sid('forums.'.$phpEx),

When I call them in the overall_header, the only time the links rewrite is if I am on that particular page. In otherwords, I have to be on portal page 4 in order for the link in the overall header to read downloads-p4.html

Also, there are duplicates.

portal.php?page=2 and about-us-p2.html are both available with no redirects.

Here's where I'm using it:

www.tech4teachers.org

Other than those two minor things, I am very, very happy with the way this has turned out so far.

Oh yeah, one other thing. Is there any way I can insert "Tech4Teachers.org | " in front of the dynamic page titles? I'm guessing I need to edit this line:

$page_title = !empty($layout_row['name']) ? $layout_row['name'] : $lang['Home'];

Thanks again, dcz. :)
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby coyote » Fri Oct 12, 2007 4:41 am

For the moment I just changed the links on the navigation menu to the rewritten URL's. That will serve the same purpose as zero dupe since there's nowhere else that phpbb would ever output portal.php?page=XX on its own.
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby dcz » Sun Oct 21, 2007 12:03 pm

It must be because the page titles are not transmitted to the phpBB SEO class at this stage.

There must be a title for each of these links you could grab using something similar to :
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( !isset($phpbb_seo->seo_url['portal_page'][$page_id]) ) {
   $phpbb_seo->seo_url['portal_page'][$page_id] = $phpbb_seo->format_url($page_title, $phpbb_seo->seo_static['portal_page']);
}
// www.phpBB-SEO.com SEO TOOLKIT END


Before these links are built.

But you can stick to hard coded links if they are meant to always be there.
Or you could just populate the $phpbb_seo->seo_url['portal_page'] array in the phpBB SEO class, would allow you to chose an url not necessarily the same as the page title.

Code: Select all
$this->seo_url['portal_page'] = array( 1 => 'first-page-url',

...
Before the end of the constructor method.

++
dcz
Administrateur - Site Admin
Administrateur - Site Admin
 
Posts: 17678
Joined: Fri Apr 28, 2006 9:03 pm

Postby coyote » Sun Oct 21, 2007 1:49 pm

Actually, dcz, I kind of like it how it is. :)

Thanks again for all the advice.
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Postby coyote » Tue Oct 23, 2007 4:44 pm

dcz,

The way you wrote it originally I can use any URL to get to the page as long as it has -pxx in it.

-www.tech4teachers.org/contact-us-p3.html
-www.tech4teachers.org/foobar-p3.html
-www.tech4teachers.org/dont-contact-us-you-twit-p3.html

-www.rsdsupport.com/games-p7.html
-www.rsdsupport.com/play-free-games-p7.html
-www.rsdsupport.com/a-huge-waste-of-time-p7.html

;)
coyote
phpBB SEO Team
phpBB SEO Team
 
Posts: 93
Joined: Fri May 11, 2007 6:24 am

Next

Return to phpBB2 Mods and Code




  • Similar topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest