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  
 
   
PHPbb3 Seo Advanced Mod, Creating titles

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB3 SEO MODS
::  
Author Message
splitice



Joined: 15 Mar 2008
Posts: 4

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Thu Mar 20, 2008 1:46 am    Post subject: PHPbb3 Seo Advanced Mod, Creating titles

I was just wondering if there is any easy way of generating the urls to access threads using php. I have already converted all the other types of urls, just the threads one.

The format I am using if it helps is /forum/topic-t99/ if it helps

Thanks in advance,
Splitice
Back to top
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 707

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Fri Mar 21, 2008 3:56 am    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

splitice wrote:
I was just wondering if there is any easy way of generating the urls to access threads using php.

Err, could you be a little more vague? Laughing

Seriously... Would you elaborate on what you want to do? Sure, you can model your code after the code in the premod, it is all marked with:

Code:
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
...
// www.phpBB-SEO.com SEO TOOLKIT END

_________________
Dan Kehn
Back to top
Visit poster's website
splitice



Joined: 15 Mar 2008
Posts: 4

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Fri Mar 21, 2008 5:03 am    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

sorry for being vauge basicly I want to know if there is a function that will make the URL for viewtopic from the topicid.

Its really hard to explain so basicly I have my sitemap
-http://usharez.com/sitemap.xml

and then an individual forums sitemap

-http://usharez.com/forum-179.xml

I want to change the urls like -http://usharez.com/viewtopic.php?f=179&t=26069 to be phpbb3 SEO URLS
Back to top
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 707

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Fri Mar 21, 2008 2:30 pm    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

Sorry, I'm not getting a much clearer picture. Confused

You can obviously model your code after the URL remapping code from viewtopic.php. Basically the code set off by "// www.phpBB-SEO.com SEO TOOLKIT BEGIN/END" caches the topic title to ID mapping, forum title to ID mapping, etc. in the $phpbb_seo class instance and then the code in append_sid calls format_url (or similar method). You could call $phpbb_seo methods directly; all the "setup" code you see in viewtopic.php etc. is to enable append_sid to do the URL remapping; this approach was chosen because phpBB has the convention that every single forum URL passes by append_sid, thereby enabling a single location for the remapping invocations.

Without more details (code snippets), I cannot advise you further. Reviewing the code noted above should answer your questions.

_________________
Dan Kehn
Back to top
Visit poster's website
splitice



Joined: 15 Mar 2008
Posts: 4

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Sat Mar 22, 2008 12:31 am    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

sorry im not a good explainer when it comes to using terms.

Anyway heres the code of google-sitemap.php
Code:
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @author Tobi Schäfer http://www.seo-phpbb.org/
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);

$domain_root = generate_board_url() . '/';

if (isset($_GET['fid']))
{
   if (is_numeric($_GET['fid']))
   {
      $fid = $_GET['fid'];
   }
}

echo header('Content-Type: text/xml; charset=utf-8');

if (isset($fid))
{
   echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
   echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";

   $sql = 'SELECT  forum_topics, forum_id, forum_name FROM ' . FORUMS_TABLE . '
         WHERE forum_id = "' . (int) $fid . '"';
   $result = $db->sql_query($sql);
   $forum_data = $db->sql_fetchrow($result);
   // Forums
   echo '<url>' . "\n";
   echo '   <loc>' . $domain_root .$phpbb_seo->format_url($forum_data['forum_name']).'-f' . $forum_data['forum_id'] . '</loc>' . "\n";
   echo '   <changefreq>hourly</changefreq>'. "\n";
   echo '</url>' . "\n";

   // Forums with more that 1 page
   if ( $forum_data['forum_topics'] > $config['topics_per_page'] )
   {
      $s = 0;
      $pages = $forum_data['forum_topics'] / $config['topics_per_page'];
      for ($i = 1; $i < $pages; $i++)
      {
         $s = $s + $config['topics_per_page'];
         echo '<url>' . "\n";
   echo '   <loc>' . $domain_root .$phpbb_seo->format_url($forum_data['forum_name']).'-f' . $forum_data['forum_id'] . '/page'.$s.'.html</loc>' . "\n";
         //echo '   <loc>' . $domain_root .  'viewforum.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;start=' . $s . '</loc>' . "\n";
         echo '   <changefreq>hourly</changefreq>' . "\n";
         echo '</url>' . "\n";
      }
   }

   if ($forum_data['forum_id'] == $fid)
   {
      $sql = 'SELECT t.topic_title, t.topic_replies, t.topic_last_post_id, t.forum_id, t.topic_type, t.topic_id, p.post_time, p.post_id
            FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
            WHERE t.forum_id = ' . $fid . '
               AND p.post_id = t.topic_last_post_id
            ORDER BY t.topic_type DESC, t.topic_last_post_id DESC';
      $result = $db->sql_query($sql);

      while ($data = $db->sql_fetchrow($result))
      {
         // Topics
         echo '<url>' . "\n";
         //echo '   <loc>' . $domain_root . 'viewtopic.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;t=' . $data['topic_id'] . '</loc>' . "\n";
   echo '   <loc>' . $domain_root . 'viewtopic.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;t=' . $data['topic_id'] . '</loc>' . "\n";
         echo '   <lastmod>'. date('Y-m-d', $data['post_time']),'</lastmod>' . "\n";
         echo '</url>' . "\n";

         // Topics with more that 1 Page
         if ( $data['topic_replies'] > $config['posts_per_page'] )
         {
            $s = 0;
            $pages = $data['topic_replies'] / $config['posts_per_page'];

            for ($i = 1; $i < $pages; $i++)
            {
               $s = $s + $config['posts_per_page'];
               echo '<url>' . "\n";
               echo '   <loc>' . $domain_root . 'viewtopic.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;t=' . $data['topic_id'] . '&amp;start=' . $s . '</loc>' . "\n";
               echo '   <lastmod>' . date('Y-m-d', $data['post_time']),'</lastmod>' . "\n";
               echo '</url>' . "\n";
            }
         }
      }
   }
   echo '</urlset>';
}
else
{
   echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
   echo '  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
   
   $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE;
   $result = $db->sql_query($sql);

   while($data = $db->sql_fetchrow($result))
   {
      if ($auth->acl_get('f_list', $data['forum_id']))
      {
         echo '    <sitemap>' . "\n";
         echo '       <loc>'. $domain_root . 'forum-' . $data['forum_id'] . '.xml</loc>' . "\n";
         // google sitemap error
         //echo '       <changefreq>hourly</changefreq>'. "\n";
         echo '    </sitemap>'. "\n";
      }
   }
   echo "\n".'  </sitemapindex>';
}

?>

and .htaccess
Code:

    # Lines That should already be in your .htacess
    <Files "config.php">
    Order Allow,Deny
    Deny from All
    </Files>
    <Files "common.php">
    Order Allow,Deny
    Deny from All
    </Files>

    # You may need to un-comment the following line
    # Options +FollowSymlinks
    # REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
    RewriteEngine On
    # REWRITE BASE
    RewriteBase /
    # HERE IS A GOOD PLACE TO ADD THE WWW PREFIXE REDIRECTION

RewriteCond %{REQUEST_URI} /sitemap.xml
RewriteRule (.*) /google-sitemap.php  [L]

RewriteCond %{REQUEST_URI} /forum-([0-9]+).xml
RewriteRule (.*) /google-sitemap.php?fid=%1  [L]

    #####################################################
    # PHPBB SEO REWRITE RULES - ADVANCED
    #####################################################
    # AUTHOR : dcz www.phpbb-seo.com
    # STARTED : 01/2006
    #################################
    # FORUMS PAGES
    ###############
    # FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. 'forum' REQUIRES TO BE SET AS FORUM INDEX
    # RewriteRule ^forum\.html$ /index.php [QSA,L,NC]
    # FORUM
    RewriteRule ^[a-z0-9_-]*-f([0-9]+)/?(page([0-9]+)\.html)?$ /viewforum.php?f=$1&start=$3 [QSA,L,NC]
    # TOPIC WITH VIRTUAL FOLDER
    RewriteRule ^[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
    # GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
    RewriteRule ^announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
    # TOPIC WITHOUT FORUM ID & DELIM
    RewriteRule ^[a-z0-9_-]*/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
    # PROFILES ADVANCED
    RewriteRule ^[a-z0-9_-]*-u([0-9]+)\.html$ /memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
    # USER MESSAGES ADVANCED
    RewriteRule ^[a-z0-9_-]*-m([0-9]+)(-([0-9]+))?\.html$ /search.php?author_id=$1&sr=posts&start=$3 [QSA,L,NC]
    # GROUPS ADVANCED
    RewriteRule ^[a-z0-9_-]*-g([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
    # POST
    RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L,NC]
    # THE TEAM
    RewriteRule ^the-team\.html$ /memberlist.php?mode=leaders [QSA,L,NC]
    # HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

    # FORUM WITHOUT ID & DELIM
    # THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^[a-z0-9_-]+/?(page([0-9]+)\.html)?$ /viewforum.php?start=$2 [QSA,L,NC]
    # END PHPBB PAGES
    #####################################################
Back to top
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 707

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Sat Mar 22, 2008 2:02 am    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

splitice wrote:
sorry im not a good explainer when it comes to using terms.

Anyway heres the code of google-sitemap.php

Why not use GYM (Google Yahoo MSN sitemap generator) from phpBB-seo? Yes, I know V3 is not released yet, but it makes little sense to modify your code written in 2005 when dcz will be soon releasing a sitemap mod that directly supports URL remapping.

_________________
Dan Kehn
Back to top
Visit poster's website
splitice



Joined: 15 Mar 2008
Posts: 4

PHPbb3 Seo Advanced Mod, Creating titlesPosted: Sat Mar 22, 2008 2:16 am    Post subject: Re: PHPbb3 Seo Advanced Mod, Creating titles

There is being one released. I didnt realise. How long is it expected to be? days, weeks, months
Back to top
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB3 SEO MODS
Page 1 of 1

Navigation Similar Topics

Jump to: