EZPORTAL Recent Topics

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

EZPORTAL Recent Topics

Postby PerfRen » Thu Nov 29, 2007 10:37 am

I started this post as part of another and was asked to make it a new post to help others.

I need some help with making the following code from my portal.php (now portal.html) page use the new "$phpbb_seo->" code...

Code: Select all
//
// Recent Topics
//

$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
   $forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
   $except_forum_id = '\'start\'';
}
else
{
   $except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
   {
      if ($except_forum_id == '\'start\'')
      {
         $except_forum_id = $forum_data[$i]['forum_id'];

      }
      else
      {
         $except_forum_id .= ',' . $forum_data[$i]['forum_id'];

      }
   }
}
$sql = "SELECT  f.forum_name, f.forum_id, t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, u.user_level
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u,  " . FORUMS_TABLE . " AS f
      WHERE t.forum_id NOT IN (" . $except_forum_id . ")
         AND t.topic_status <> 2
         AND p.post_id = t.topic_last_post_id
         AND p.poster_id = u.user_id
         AND f.forum_id = t.forum_id
      ORDER BY p.post_id DESC
      LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $recent_topic_row[] = $row;
}

for ($i = 0; $i < $number_recent_topics; $i++)
{
   // Start add - Username Color Mod
   switch ( $recent_topic_row[$i]['user_level'] )
   {
      case ADMIN:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor3'] . '"';
         break;
      case MAIN_MOD:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor98'] . '"';
         break;
      case MOD:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor2'] . '"';
         break;
      case SUPPORT:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor4'] . '"';
         break;
      case CLUB:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor5'] . '"';
         break;
      case BOT:
         $poster_name = '<strong>' . $recent_topic_row[$i]['username'] . '</strong>';
         $style_color = ' style="color: #' . $theme['fontcolor99'] . '"';
         break;
      default:
         $poster_name = $recent_topic_row[$i]['username'];
         $style_color = ' style="color: #006699"';
         break;
   }
   //$poster_name = '[<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']) . '"' . $style_color . '>' . $poster_name . '</a>]';
   $poster_name = '[<span' . $style_color . '>' . $poster_name . '</span>]';
   // End add - Username Color Mod

   $topic_title = $recent_topic_row[$i]['topic_title'];
   $topic_title = smilies_pass($topic_title);

   $template->assign_block_vars('recent_topic_row', array(
      'L_FORUMNAME' => $recent_topic_row[$i]['forum_name'],
      'U_FORUMNAME' => append_sid("viewforum.$phpEx?"."f=".$recent_topic_row[$i]['forum_id']),
      'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
      //'L_TITLE' => $recent_topic_row[$i]['topic_title'],
      'L_TITLE' => $topic_title,
      //'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
      //'S_POSTER' => $recent_topic_row[$i]['username'],
      'S_POSTER' => $poster_name,
      'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone']
      )
      )
   );
}
//
// END - Recent Topics
//


Idealing converting U_FORUMNAME and U_TITLE to the new formats :)


Now I was replied to with the following...

For the portal rewriting, find :
Code: Select all
   $recent_topic_row[] = $row;

after add :
Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( !isset($phpbb_seo->seo_url['forum'][$recent_topic_row['forum_id']]) ) {
      $phpbb_seo->seo_url['forum'][$recent_topic_row['forum_id']] = $phpbb_seo->format_url($recent_topic_row['forum_name'], $phpbb_seo->seo_static['forum']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END


Will do the trick for forum URL, other are post urls and already rewritten.


And I subsequently replied with...

Thanks again for the help

I have tried the code above thank you but it hasnt changed anything for me on my portal page.

My portal.tpl references {recent_topic_row.U_FORUMNAME} and {recent_topic_row.U_TITLE} for the Recent posts and has not been updated to the new format with that change you suggested for my portal.php file. Is there something else I need to do?


So Please could someone help me fix this so that other Portal users can have the correct links showing on their pages too :)

Thanks in advance.
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm

Advertisement

Postby PerfRen » Mon Dec 03, 2007 12:05 pm

Have had a PM now from a guy on here asking for the same thing and wondering if I had had any luck in fixing it - so I told him I hadnt and was waiting on some help on here like him :)

Anyone know how I can get this to work please?
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm

Postby PerfRen » Fri Dec 21, 2007 11:29 am

Can anyone help please?
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm

Postby SeO » Fri Dec 21, 2007 11:37 am

Could you post a link to your site and to where the mod is officially released ?

Aren't the forum urls rewritten with the suggested code ?

Anyway, from what you posted, it looks like the mod is building post links :

Code: Select all
    'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],


Aren't they already rewritten to postxx.html ?
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby PerfRen » Fri Dec 21, 2007 11:59 am

Yes the links are in the formats of:

postxx.html

and

viewforum.php

not the correct formats however!


Go to the Portal page and have a look at the Recent Topics Block on the left hand side.

Thats the block that needs fixing :)
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm

Postby SeO » Fri Dec 21, 2007 2:57 pm

What is the portal you are using ?

And what about the last touch ?
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby PerfRen » Sun Dec 23, 2007 12:07 am

I'm using ezportal and it is there!
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm

Postby dcz » Sun Dec 23, 2007 10:50 am

Well it should work.

Could you post here the code you try once modified ?

Just to make sure everything is where it should.

++
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: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby PerfRen » Sun Dec 23, 2007 11:25 pm

Ok will reapply the modification to the php file and upload it for you to see that it doesnt work - hopefully it will be able to show how we can fix it :)

Merry Xmas to all btw 8)
PerfRen
 
Posts: 36
Joined: Thu Nov 01, 2007 4:11 pm


Return to phpBB2 Advanced mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests