| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
ASLAN PR0

Joined: 19 Nov 2007 Posts: 58 Location: Chile
|
Posted: 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 |
|
 |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3987
|
Posted: 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&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

Joined: 19 Nov 2007 Posts: 58 Location: Chile
|
Posted: 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&t=$topic_id");
echo "<br /><br />";
}
// Desconectarse
mysql_close($link);
?> |
|
|
|
| Back to top |
|
 |
ASLAN PR0

Joined: 19 Nov 2007 Posts: 58 Location: Chile
|
Posted: Sun Aug 17, 2008 7:02 pm Post subject: Re: Help me with a Custom Example |
|
|
| Any idea ??? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
|
| Back to top |
|
 |
|
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |