phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Help me with a Custom Example

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB SEO Premod
::  
Author Message
ASLAN
PR0
PR0


Joined: 19 Nov 2007
Posts: 58
Location: Chile

Help me with a Custom ExamplePosted: Fri Aug 15, 2008 11:23 pm    Post subject: Help me with a Custom Example

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:
$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
Back to top
Visit poster's website
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 3987

Help me with a Custom ExamplePosted: Sat Aug 16, 2008 9:17 am    Post subject: Re: Help me with a Custom Example

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:
   echo $phpbb_seo->seo_url['forum'][$topic_data['forum_id']];
   echo "<br />";
   echo $phpbb_seo->seo_url['topic'][$topic_data['topic_id']];


with :

Code:
   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.

_________________
phpBB SEO || SEO Forum || Forum Référencement
GYM Sitemap & RSS for phpBB3 has been released ! || GYM Sitemap & RSS for phpBB3 est disponible !
Back to top
ASLAN
PR0
PR0


Joined: 19 Nov 2007
Posts: 58
Location: Chile

Help me with a Custom ExamplePosted: Sat Aug 16, 2008 6:37 pm    Post subject: Re: Help me with a Custom Example

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:
<?

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);

?>
Back to top
Visit poster's website
ASLAN
PR0
PR0


Joined: 19 Nov 2007
Posts: 58
Location: Chile

Help me with a Custom ExamplePosted: Sun Aug 17, 2008 7:02 pm    Post subject: Re: Help me with a Custom Example

Any idea ???
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 15242

Help me with a Custom ExamplePosted: Mon Aug 18, 2008 12:52 pm    Post subject: Re: Help me with a Custom Example

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

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


with :

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


Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB SEO Premod
Page 1 of 1

Navigation Similar Topics

Jump to: