Help me with a Custom Example

phpBB SEO Premod for phpBB3 support forum.
This premodded version of phpBB3 includes the three different type of URL rewriting for phpBB3 by phpBB SEO. It comes with several other Search Engine Optimization mods installed.

Moderator: Moderators

Help me with a Custom Example

Postby ASLAN » Fri Aug 15, 2008 11:23 pm

Hi

I'm trying to make my own custom pages, but I have a bug geting SEO URLs
See my test and you will see what I'm get a string "TOPIC" in some cases instead of Topic URL

That's my example code
Code: Select all
$query = "select * from hol_topics where topic_id>2870 and topic_id<2880";
$result = mysql_query($query,$link);

while ($topic_data = mysql_fetch_assoc($result)) {

   $forum_id = $topic_data['forum_id'];
   $topic_id = $topic_data['topic_id'];

   $phpbb_seo = new phpbb_seo();
   
   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($topic_data['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = censor_text($topic_data['topic_title']);
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
   }
   if ( empty($phpbb_seo->seo_url['forum'][$topic_data['forum_id']]) ) {
      $phpbb_seo->seo_url['forum'][$topic_data['forum_id']] = $phpbb_seo->set_url($topic_data['forum_name'], $topic_data['forum_id'], $phpbb_seo->seo_static['forum']);
   }

   echo "<b>" . $topic_data['topic_title'] . "</b>";
   echo "<br />";
   echo $phpbb_seo->seo_url['forum'][$topic_data['forum_id']];
   echo "<br />";
   echo $phpbb_seo->seo_url['topic'][$topic_data['topic_id']];
   echo "<br /><br />";

}

?>



Thanks for any help
ASLAN
PR0
PR0
 
Posts: 58
Joined: Mon Nov 19, 2007 2:38 am
Location: Chile

Advertisement

Postby SeO » Sat Aug 16, 2008 9:17 am

If you included common.php, you do not need to start the phpbb_seo class again. Otherwise it will be more complex to end up with the proper rewriting.
As well, if you include common.php in your script, and thus fully share phpBB code, you should avoid using the php mysql function, but rather use phpBB ones.

Then, you should replace :

Code: Select all
   echo $phpbb_seo->seo_url['forum'][$topic_data['forum_id']];
   echo "<br />";
   echo $phpbb_seo->seo_url['topic'][$topic_data['topic_id']];


with :

Code: Select all
   echo append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
   echo "<br />";
   echo append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");


Assuming of course that $phpbb_root_path is properly set.
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby ASLAN » Sat Aug 16, 2008 6:37 pm

Thanks for your help, but same error
See result in http://www.comunidadholistica.org/test.php

Many URLs are ...topic.html

That's my code

Code: Select all
<?

define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = './';
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'lib-sitemap.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

//Conectarse
$link = Conectarse();

//Consulta
$query = "SELECT *
         FROM hol_topics, hol_forums
         WHERE hol_topics.forum_id=hol_forums.forum_id and hol_topics.topic_id>2870 and hol_topics.topic_id<2880";
$result = mysql_query($query,$link);
 
while ($topic_data = mysql_fetch_assoc($result)) {

   $forum_id = $topic_data['forum_id'];
   $forum_name = $topic_data['forum_name'];
   $topic_id = $topic_data['topic_id'];
   $topic_type = $topic_data['topic_type'];
   $topic_title = $topic_data['topic_title'];

   if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($topic_data['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = censor_text($topic_title);
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
   }
   if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($forum_name, $forum_id, $phpbb_seo->seo_static['forum']);
   }

   echo append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id");
   echo "<br />";
   echo append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");
   echo "<br /><br />";

}

// Desconectarse
mysql_close($link);

?>
ASLAN
PR0
PR0
 
Posts: 58
Joined: Mon Nov 19, 2007 2:38 am
Location: Chile

Postby ASLAN » Sun Aug 17, 2008 7:02 pm

Any idea ???
ASLAN
PR0
PR0
 
Posts: 58
Joined: Mon Nov 19, 2007 2:38 am
Location: Chile

Postby dcz » Mon Aug 18, 2008 12:52 pm

I think it's just the typo in the forum link (used viewtopic :roll:), try to replace :

Code: Select all
   echo append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id");


with :

Code: Select all
   echo append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");


;)
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: 21375
Joined: Fri Apr 28, 2006 9:03 pm


Return to phpBB SEO Premod

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 5 guests