| |
|
| :: |
| Author |
Message |
frechdaxx
Joined: 04 Sep 2007 Posts: 20
|
Posted: Mon Oct 29, 2007 6:42 pm Post subject: Rewriting the nv newspage mod |
|
|
Hey,
I have installed your Advanced Seo Url mod, which works very well
But I got some questions:
When I get to the last post I get the link:
http://www.roqbar.de/post2003.html#p2003
why not http://www.roqbar.de/post2003.html ?
In the demo it is like: http://phpbb3.phpbb-seo.net/forum-de-test/and-test-for-czech-language-t40.html#p64
which I like much more, but I think its because of the duplicated content?
I got a little newspage on my board on:
www.roqbar.de
Its the Mod: http://www.phpbb.com/community/viewtopic.php?f=70&t=579245
Now I want to have some rewritten URLs in this mod, too, not the /post***.html ones, but the one to the start topic, because when google searches my root it just finds the post*** urls, which are disabled in the robots.txt anyway. Also I wanted to know generally how I can put the rewritten urls in another page or mod, for example a recent posts mod, which doesn't use your mod Instructions would be very cool, maybe some on the newspage code:
[mod]
Link to the mod's release thread is enough
[/mod]
Thanks a lot for your help and the great mod  |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14854
|
Posted: Tue Oct 30, 2007 8:55 am Post subject: Re: Rewriting the nv newspage mod |
|
|
| frechdaxx wrote: | Hey,
I have installed your Advanced Seo Url mod, which works very well  |
Great
Well, it's just to position the browser window in front of the proper post. Without the anchor (#pxx), you'd always see the top of the page, even if the post is at the bottom.
Since these two are not duplicate, it's handier like this IMHO.
The no duplicate mod is the one that gets rid of post URLs.
Post url are duplicate of topic url, the only ones that matters, but it's no big deal to keep them as long as you set up your robots.txt properly.
| frechdaxx wrote: |
I got a little newspage on my board
|
So for the nv newsmod, I guess that adding :
| Code: |
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
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;
}
$row['topic_title'] = censor_text($row['topic_title']);
$phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($row['topic_title']);
}
if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
$phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'],$forum_id, $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END |
After :
| Code: | while ($row = $db->sql_fetchrow($result))
{
//set some default vars
$post_id = $row['post_id'];
$poster_id = $row['poster_id'];
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id']; |
in newspage.php will be enough to rewrite everything, the problem is the mod nevers outputs a topic or a forum url it seems.
There is an odd line in the code :
| Code: | | 'U_NEWS' => append_sid("{$phpbb_root_path}viewnews.$phpEx", 'news=' . $topic_id), |
I can't see any viewnews.php file in the package.
++ |
_________________ 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 |
|
 |
frechdaxx
Joined: 04 Sep 2007 Posts: 20
|
Posted: Tue Oct 30, 2007 6:15 pm Post subject: Re: Rewriting the nv newspage mod |
|
|
| dcz wrote: |
There is an odd line in the code :
| Code: | | 'U_NEWS' => append_sid("{$phpbb_root_path}viewnews.$phpEx", 'news=' . $topic_id), |
I can't see any viewnews.php file in the package.
++ |
thats because the author forgot the change that files in a new release, it must be
'U_NEWS' => append_sid("{$phpbb_root_path}newspage.$phpEx", 'news=' . $topic_id),[/code]
Thanks for your great support, I really appreciate that your extensive answers I'll try that code now
Edit: Links doesn't change at all
They stay like: http://www.roqbar.de/post1994.html#p1994 |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14854
|
Posted: Sat Nov 03, 2007 12:18 pm Post subject: Re: Rewriting the nv newspage mod |
|
|
Well, it's a rewritten link, but you can add :
| Code: | // www.phpBB-SEO.com SEO TOOLKIT BEGIN
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;
}
$row['topic_title'] = censor_text($row['topic_title']);
$phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($row['topic_title']);
}
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
if (($replies + 1) > $phpbb_seo->seo_opt['topic_per_page']) {
$phpbb_seo->seo_opt['topic_last_page'][$topic_id] = floor($replies / $phpbb_seo->seo_opt['topic_per_page']) * $phpbb_seo->seo_opt['topic_per_page'];
}
if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
$phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'],$forum_id, $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END |
Still after :
| Code: | while ($row = $db->sql_fetchrow($result))
{
//set some default vars
$post_id = $row['post_id'];
$poster_id = $row['poster_id'];
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id']; |
And then replace :
| Code: | | 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . (($row['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'], |
With :
| Code: |
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&start=' . @intval($phpbb_seo->seo_opt['topic_last_page'][$topic_id])) . '#p' . $row['post_id'],
// www.phpBB-SEO.com SEO TOOLKIT END |
In newspage.php.
About the newspage itself, the links could be problematic if the regular topic URL is accessible too, because it would mean duplicate content.
But you can easily have them rewritten, to do so you'd need to edit the phpbb_seo_class.php file a bit.
Find :
| Code: | | $this->seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'index' => (!empty($this->seo_static['index']) ? '.html' : ''), 'global_announce' => '/', 'leaders' => '.html', 'pagination' => '.html', 'gz_ext' => ''); |
after add :
| Code: | // NV_newspage mod
$this->seo_url['newspage'] = array();
$this->seo_delim['newspage'] = '-n';
$this->seo_static['newspage'] = 'news';
$this->seo_ext['newspage'] = '.html';
// NV_newspage mod |
Find :
| Code: | $this->seo_opt['rewrite_functions'] = array( 'viewtopic' => $this->seo_opt['virtual_folder'] ? 'viewtopic_uadv' : 'viewtopic_adv',
'viewforum' => $this->seo_opt['virtual_folder'] ? 'viewforum_uadv' : 'viewforum_adv',
'index' => 'index',
'memberlist' => 'memberlist',
); |
After add :
| Code: | // NV_newspage mod
$this->seo_opt['rewrite_functions']['newspage'] = 'newspage';
// NV_newspage mod |
Find :
| Code: | /**
* URL rewritting for index.php
* @access private
*/
function index() {
$this->path = $this->seo_path['phpbb_urlR'];
$this->url = $this->seo_static['index'] . $this->seo_ext['index'];
return;
} |
After add :
| Code: |
// NV_newspage mod
/**
* URL rewritting for newspage.php
* Without Virtual Folder Injection
* @access private
*/
function newspage() {
$this->path = $this->seo_path['phpbb_url'];
if ( !empty($this->get_vars['news']) && !empty($this->seo_url['topic'][$this->get_vars['news']]) ) {
$this->url = $this->seo_url['topic'][$this->get_vars['news']] . $this->seo_delim['newspage'] . $this->get_vars['news'] . $this->seo_ext['newspage'];
unset($this->get_vars['news']);
return;
}
return;
}
// NV_newspage mod |
You'll need to add a rewriterule to your .htaccess, add :
| Code: | # Nv_newsmod
RewriteRule ^[a-z0-9_-]*-t([0-9]+)\.html$ /newspage.php?news=$1 [QSA,L,NC] |
after :
| Code: | | # HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES |
Should do the trick
++ |
_________________ 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 |
|
 |
frechdaxx
Joined: 04 Sep 2007 Posts: 20
|
Posted: Sun Nov 04, 2007 11:08 pm Post subject: Re: Rewriting the nv newspage mod |
|
|
Thx, I will try that tomorrow Really impressive what excellent support you give |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

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