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  
 
   
Solution how to make phpbbSEO mod to work for all languages

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite
::  
Author Message
augustas



Joined: 20 Sep 2007
Posts: 2

Solution how to make phpbbSEO mod to work for all languagesPosted: Fri Sep 21, 2007 7:25 pm    Post subject: Solution how to make phpbbSEO mod to work for all languages

Hello,

I would like to share the modification of format_url() function in phpbb_seo_class.php in order to make phpbbseo mod to work with any language. Just I am not sure if the convertion of words will make sence when using non ascii languages Rolling Eyes

So,

1. Make sure iconv is installed on your server.

2. Download the package "utf8_to_ascii" from phputf8 project:
http://sourceforge.net/project/showfiles.php?group_id=142846

3. Extract that package and upload "utf8_to_ascii.php" file and /db/ folder to the /phpbb_seo/ folder on your forum server.

4. In phpbb_seo_class.php file:

4.1 write the encoding of your forum language in this line:
Code:
$this->encoding = "iso-8859-1";


4.2. Replace format_url() function by this:

Code:

function format_url( $url, $type = 'topic' ) {
   require_once dirname(__FILE__).'/utf8_to_ascii.php';
   if(strtolower($this->encoding) != "utf-8") $url = iconv($this->encoding,"utf-8",$url);
   $url = utf8_to_ascii($url,"");
   $url = preg_replace("/[^a-z0-9]+/i","-",$url);
   $url = ( $url == "" ) ? $type : strtolower(trim($url, '-'));
   return $url;
}   


Now test how your forum creates the SEO links.

I wonder if it makes sence in all languages, but at least this method you can easily use for e.g., Baltic Language encodings (like iso-8859-13) which are not supported by phpbbSEO mods / htmlentities().
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 15127

Solution how to make phpbbSEO mod to work for all languagesPosted: Mon Sep 24, 2007 11:30 am    Post subject: Re: Solution how to make phpbbSEO mod to work for all languages

Thanks for this contribution.

I think though that your method won't properly deal with accents.

What you could do is use iconv() to go for utf-8, and then let the original code do it's job :

Code:
   function format_url( $url, $type = 'topic' ) {
      $url = preg_replace("`\[.*\]`U","",$url);
      $url = iconv($this->encoding,"utf-8",$url);
      $url= htmlentities($url, ENT_COMPAT, 'UTF-8');
      $url= preg_replace( "`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i","\\1", $url );
      $url = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$url);
      $url = preg_replace("`[^a-z0-9]`i", "-", $url);
      $url = preg_replace("`[-]+`", "-", $url);
      $url = trim($url, '-');
      $url = ( $url == "" ) ? $type : strtolower($url);
      return $url;
   }


++

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: