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  
 
   
Language Problem

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » GYM Sitemaps & RSS
::  
Author Message
jonli447



Joined: 31 Oct 2007
Posts: 17

Language ProblemPosted: Sat Jul 19, 2008 9:48 pm    Post subject: Language Problem

Hello all,

I just installed this mod, and I found an issue with the XSL transformation. On my site, the US language, en_us, is installed as the default. I was testing out this mod, and I noticed that the sitemap was not being transformed.

I took a look at the HTTP headers, and noticed that "http://forum.example.com/gym_sitemaps/gym_style.php?action-google,type-xsl,lang-en_us,theme_id-2
" is being called for the XSL transformation.

I manually opened the above url in my browser, and the gym_style.php outputs nothing and dies (no output is sent to the browser). I modified the url, so that the "lang" was "lang-en" (for British English) instead of "lang-en_us" (US English). gym_style.php displayed the XSL output fine.

As a result, I think there's a bug whereas if the default language has iso language tag like "en_us" rather than the normal two letter tags, i.e. "en" or "de", the gym_style.php crashes. I was going to look into this further, but I thought it was best not to hack this otherwise brilliant mod.

Thanks for your help.

Jon a.k.a. jonli447
Back to top
jonli447



Joined: 31 Oct 2007
Posts: 17

Language ProblemPosted: Sat Jul 19, 2008 11:18 pm    Post subject: Re: Language Problem

Okay, I fixed the regular expression for the lang tag. Here's the following changes I did. Someone can double check my expression, but I think it's sound. It'll return the standard two letter iso tag if the language in question contains it, or the special xx_xx tag, i.e. en_us, if the language contains it.

Open gymsitemaps/gym_sitemaps/gym_style.php:

Find:
Code:
   preg_match('`action-(rss|google),type-(xsl),lang-([a-z]+),theme_id-([0-9]+)`', $qs, $matches );

And change line to:
Code:
   preg_match('`action-(rss|google),type-(xsl),lang-([a-z]+[_]?[a-z]?[a-z]?),theme_id-([0-9]+)`', $qs, $matches );


I believe this fixes my problem completely, but I'll dig forward.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14327

Language ProblemPosted: Sun Jul 20, 2008 12:33 pm    Post subject: Re: Language Problem

Thanks for reporting, it's a real, but not to big, bug.

As you saw, this comes from the RegEx used to grab the language code, we need to do it like this because FF only accepts escaped &'s (&) where IE and Opera will only accept un-escaped &'s in the xml xsl style sheet's link Rolling Eyes

The proper RegEx though, would rather just be :

Code:
   preg_match('`action-(rss|google),type-(xsl),lang-([a-z_]+),theme_id-([0-9]+)`i', $qs, $matches );


yours works, but is a bit less efficient, which of course in our case does not matter, but ...

I as well added the i option to be able to match upper cases too, since we never knwo ...

Thanks again for reporting Wink

++

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



Joined: 31 Oct 2007
Posts: 17

Language ProblemPosted: Sun Jul 20, 2008 3:40 pm    Post subject: Re: Language Problem

Thanks for confirming the bug.

FYI, it was late yesterday, and I couldn't remember how to add the "_" to the pattern. I just did it the lazy way, and I figured someone would remember and correct me. Razz
Back to top
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » GYM Sitemaps & RSS
Page 1 of 1

Navigation Similar Topics

Jump to: