Ist there some API for integration ...

Zero duplicate support forum. Personalized HTTP 301 dynamic redirections for phpBB.

Moderator: Moderators

Ist there some API for integration ...

Postby LMS » Sat Mar 13, 2010 12:10 pm

Hi!

I try to integrate some you SEO extensions in the Static Pages MOD. Specialy the Zero Duplicate mechanism, to consolidate the the /page.php calls.

Ist there some extension API systematic in the SEO MOD?

I see the posibility to hook up with names to functions and also some kind of plugin system under the includes/htmods, but i dont see where i should start with the definitions. Or is the only posibility to declare the nessesary functions and add the definitions to the seo_static and rewrite_method in the setup_phpbb_seo.php?

Thx for you advise,
Michael
LMS
 
Posts: 4
Joined: Fri Mar 12, 2010 11:54 am

Advertisement

Re: Ist there some API for integration ...

Postby SeO » Sun Mar 14, 2010 12:29 am

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


;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm


Return to Zero duplicate

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests