Interesting, that could be a cool add on actually. And since these static page should not use more GET variable than the basic phpBB ones (sid= and style=), you can turn the zero dupe on in these after session started with just this :
- Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_chk_dupe($phpbb_seo->seo_path['phpbb_url'] . "name_of_the_file.$phpEx");
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe
Now for example, if this page had to deal with pagination (start param), yiou would have to declare the variable :
- Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$start = $phpbb_seo->seo_chk_start( $start, $config['topics_per_page'] );
$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
'start' => array('val' => $start, 'keep' => $start),
);
$phpbb_seo->seo_chk_dupe($phpbb_seo->seo_path['phpbb_url'] . "name_of_the_file.$phpEx");
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe
Assuming that $start was defined just before and set to a positive integer :
- Code: Select all
$start = max(0, request_var('start', 0));
And $config['topics_per_page'] would be your number of item per page (can be changed).
This would make sure that start is consistent with the item per page set. If you also want to bound it to the highest page available, you need to know the number of item total before this. If you have the information, you can use something like (from viewtopic.php) :
- Code: Select all
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total_items)
{
$start = ($start < 0) ? 0 : floor(($total_items- 1) / $config['topics_per_page']) * $config['topics_per_page'];
}
before the zero dupe code.
The redir_def array can old many more variables, in the order they should appear when building links (meaning that the order is important when building links with append_sid), you have good example of all possible usages in viewtopic.php.
Note that if you url rewrite these static pages, you will have to pass the rewritten url to phpbb_seo::seo_chk_dupe, and the url requires the full domain. In strict mode, no more get variable than the one declared in the redir_def array can be used.
You can make this code working with all filenames (if you keep them in url) pretty easly, using :
- Code: Select all
// From session.php
$script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
// Replace backslashes and doubled slashes (could happen on some proxy setups)
$script_name = str_replace(array('\\', '//'), '/', $script_name);
// basenamed page name (for example: index.php)
$page_name = basename($script_name);
