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  
 
   
SEO mod Api :) ?

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



Joined: 11 Feb 2008
Posts: 16

SEO mod Api :) ?Posted: Sun Feb 17, 2008 4:47 am    Post subject: SEO mod Api :) ?

Hi,

I will be adding some "features" to my forum, such as rss feeds and extra page types..

I would like to know how I can easily "translate" urls into the right SEO modded one....

Forums and Topics only....

Thanks!
Back to top
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 2430

SEO mod Api :) ?Posted: Sun Feb 17, 2008 12:20 pm    Post subject: Re: SEO mod Api :) ?

For the rss feeds, you may prefer to wait until we release the GYM sitemaps module for phpBB3, teaser :
-http://phpbb3.phpbb-seo.net/rss.php
-http://phpbb3.phpbb-seo.net/rss.php?m
-http://phpbb3.phpbb-seo.net/sitemap.php

The version demonstrated is the very first alpha one, we're now pretty close to beta. And yes the feeds will be valid Wink

About the api, well, yes that would be a very good thing to start some clear documentation, time time time.

Basics though are pretty easy, all we do is grad the title to inject (if any) before the first link is build using append_sid() :

Example in viewforum.php :

Code:
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( empty($phpbb_seo->seo_url['forum'][$forum_data['forum_id']]) ) {
   $phpbb_seo->seo_url['forum'][$forum_data['forum_id']] = $phpbb_seo->set_url($forum_data['forum_name'], $forum_data['forum_id'], $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END


for forums, with cach check and :

Code:
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      if ( empty($phpbb_seo->seo_url['topic'][$row['topic_id']]) ) {
         $phpbb_seo->seo_censored[$row['topic_id']] = censor_text($row['topic_title']);
         $phpbb_seo->seo_url['topic'][$row['topic_id']] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$row['topic_id']]);
      }
      // www.phpBB-SEO.com SEO TOOLKIT END


for topics, straight title injection only.

We do not need to grab title this way for the simple mod, topic title are only required for the mixed mod.
All three mod uses the same base, only title injection is added.
In phpbb_seo_class.php, you'll find specific delimiters, static term (topic for topics, 'forum' for forums etc ...) and suffixes which can be customized as explained in the install file.
You can add more if you want.
Then, rewriting and paginating functions are stored in the $this->rewrite_functions array which will be used in the url_rewrite method to determine which method to use to perform the url rewriting.

This allows us to switch among methods (and available url standards) depending on the setting used, as you can see, there is more than one method for viewtopic.php, to properly and efficiently handle the virtual folder trick.

You can thus declare more url rewriting method for other file, like portal.php, the only restriction, since we use the filename to switch between method, is that you only ba able to rewrite files with different filenames. Not two index.php file within different dirs for example.

If you know a bit of php, it's not so complex in the end, you add new methods and fill new array to extend url rewriting.
URL rewriting methods are pretty simple, what's a bit less is default var value and useless var filtering, it's not necessarily easy to find out about all these useless vars that could be thrown by the mod.

Take a look at the phpBB2 patches, such as the smartor album one, it's a bit different on phpBB3, but the complete example of url rewriting extending is still interesting if you want to understand more things.
The phpBB3 version is still using the same type of principles, it's pretty similar.

When building huge list (like in sitemaps), it's more efficient to build the links directly like it is done in the phpBB2 GYM sitemaps module (you can do it directly with the phpbb_seo class vars, in GYM we wrap them to be compatible with any mod, but the principle is the same) than to pass through append_sid, since we usually do not deal with useless vars and very special cases (only topic listing).

_________________
Back to top
bv



Joined: 11 Feb 2008
Posts: 16

SEO mod Api :) ?Posted: Sun Feb 17, 2008 1:36 pm    Post subject: Re: SEO mod Api :) ?

I speak basic php, very basic.

Just for my understranding, I have made my "own" rss feed, and I display the urls like this:

$topic_link = 'viewtopic.php?f='.$row['forum_id'].'&t='.$row['topic_id'];

What would I put there to get the seo'd urls instead into $topic_link?

thanks,
Back to top
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 2430

SEO mod Api :) ?Posted: Sun Feb 17, 2008 2:35 pm    Post subject: Re: SEO mod Api :) ?

The full trick should take the several phpBB seo url rewriting standard into account.

But you can only code enough for the one you are using, since you're not suppose to change it once you've chosen it.

So the solution will depend on the url rewriting type and settings you are using.

Tell me witch and I'll tell you more Wink

_________________
Back to top
bv



Joined: 11 Feb 2008
Posts: 16

SEO mod Api :) ?Posted: Sun Feb 17, 2008 3:47 pm    Post subject: Re: SEO mod Api :) ?

I just want to change

viewforum.php?f=2 into forum_title-f2/

and

viewtopic.php?f=2&t=579376 into forum_title-f2/topic_title-t579376.html
Back to top
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 2430

SEO mod Api :) ?Posted: Tue Feb 19, 2008 9:38 am    Post subject: Re: SEO mod Api :) ?

All right, so it's decently simple Wink

So, since I don't know your code, I'll assume that the code provides with the info we need to properly rewrite urls.

You are in the advanced case with the virtual folder trick, so you need the full story.

So let's say that the $forum_name, $forum_id, $topic_title, $topic_id and $topic_type are available.

And let's assume as well that the phpbb_seo class is available in your script (if you include common.php the class is started, you may need to globalise it if you are using it within a function).

So, the code building urls should look like :
Code:
$forum_url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id";
$topic_url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id";


Before this, you need to add :

Code:
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
   $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,$topic_data['forum_id'], $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END


All this does is to properly format topic and forum injection bit with topic title censoring and cached forum urls (if any). It will as well make sure you'll only format each injection bit once.

Then, you should replace :
Code:
$forum_url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id";
$topic_url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id";


with :
Code:

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$forum_url = $phpbb_seo->seo_path['phpbb_urlR'] . $phpbb_seo->seo_url['forum'][$forum_id] . $phpbb_seo->seo_ext['forum'];
$topic_url = $phpbb_seo->seo_url['topic'][$topic_id] . $phpbb_seo->seo_delim['topic'] . $topic_id . $phpbb_seo->seo_ext['topic'];
if ($topic_type == POST_GLOBAL) {
   $topic_url = $phpbb_seo->seo_static['global_announce'] . $phpbb_seo->seo_ext['global_announce'] . $topic_url;
} else {
   $topic_url = $forum_url . $topic_url;
}
// www.phpBB-SEO.com SEO TOOLKIT END


This will take the global announces case into account as well.

Wink

_________________
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13099

SEO mod Api :) ?Posted: Mon Feb 25, 2008 1:11 pm    Post subject: Re: SEO mod Api :) ?

So, how is it working ?

++

_________________
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
bv



Joined: 11 Feb 2008
Posts: 16

SEO mod Api :) ?Posted: Mon Feb 25, 2008 1:21 pm    Post subject: Re: SEO mod Api :) ?

No... Confused

I have played a bit, but no luck....

This is what I have for my rss feed..... (in part)

Code:
<?php
header('Content-type: application/xml');
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'language/en/common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$base_url = "http://swisspod.com/";

$rss_result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
 <title>swiss Expat Forum Recent Posts</title>
 <link>http://swisspod.com/</link>
 <description>".$config['site_desc']."</description>
 <language>".$config['default_lang']."</language>
 <copyright>Copyright by ".$config['sitename']."</copyright>
 <managingEditor>".$config['board_email']." (Forum Admin)</managingEditor>
 <generator>swissPod RSS</generator>
 <atom:link href=\"http://swisspod.com/rss.php\" rel=\"self\" type=\"application/rss+xml\" />
 ";
//
// This SQL query selects the latest topics of all forum
//
 
$sql = 'SELECT f.forum_id,f.forum_name, f.forum_desc_options, t.topic_title, t.topic_id,t.topic_last_post_id,t.topic_last_poster_name, p.post_time, p.post_text, p.bbcode_uid, p.bbcode_bitfield, u.username, u.user_id
FROM  '. FORUMS_TABLE .'  f,'.TOPICS_TABLE.' t, '.POSTS_TABLE.' p,'.USERS_TABLE.' u
WHERE t.forum_id = f.forum_id
AND t.topic_status != 1
AND p.post_id = t.topic_last_post_id
AND u.user_id = p.poster_id
ORDER BY t.topic_last_post_id DESC
LIMIT 30 ';
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get Latest topics", '', __LINE__, __FILE__, $sql);
}
while($row = $db->sql_fetchrow($result))
{
$forumid=$row['forum_id'];
  if($auth->acl_get('f_read',$forumid))  //getting authentication
{
$post_link = 'viewtopic.php?f='.$row['forum_id'].'&amp;t='.$row['topic_id'].'#p'.$row['topic_last_post_id'];
$//post_link =  append_sid($post_link);
$topic_link = 'viewtopic.php?f='.$row['forum_id'].'&amp;t='.$row['topic_id'];
//$topic_link = append_sid($topic_link);

$description = $lang['POST_BY_AUTHOR']." ".$row['topic_last_poster_name']." - ".$lang['POSTED']." ".$user->format_date($row['post_time'])."<br /><br /><a href=\"$base_url$topic_link\">Read ".$row['topic_title']."</a><br /><br /><a href=\"http://swisspod.com/\">swiss Expat Forum swiss Pod</a>"."<hr />";
$rss_result .= "
<item>
<title>".$row['topic_title']."</title>
<link>".$base_url.$post_link."</link>
<description><![CDATA[". $description . "]]></description>
<pubDate>".date("r",$row['post_time'])."</pubDate>
  <guid isPermaLink=\"true\">".$base_url.$post_link."</guid>
 </item>";
}
}
$rss_result .= "</channel>
</rss>";
echo $rss_result;
$db->sql_freeresult($result);
?>



I also want to make a Topic top 20, Last 20 topics, etc etc... Question


Last edited by bv on Mon Feb 25, 2008 6:07 pm; edited 2 times in total
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13099

SEO mod Api :) ?Posted: Mon Feb 25, 2008 5:56 pm    Post subject: Re: SEO mod Api :) ?

Well this code is meant for phpBB2, does it share sessions with phpBB ?

_________________
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
bv



Joined: 11 Feb 2008
Posts: 16

SEO mod Api :) ?Posted: Mon Feb 25, 2008 6:05 pm    Post subject: Re: SEO mod Api :) ?

No it isn't. Maybe it once was, I don't know Smile (I have posted it in whole now see above)

Its downloaded from somewhere, dunno where anymore. It works. Shitty. But works.
Back to top
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

Jump to: