Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   SwitchLang Function (http://forum.bytesforall.com/showthread.php?t=5664)

Lyryanne Feb 2, 2010 04:46 AM

SwitchLang Function
Hi all ^^,

I've a little problem with a function SwitchLang, for my website I have two languages, French and English.

All the pages on my site have the same name in french and english and the only distinction is :

So I've search on the Internet and I've found this piece of code :


function switchLang ($mode) {
          $posfr = strpos($_SERVER['REDIRECT_URL'],"/fr/");
          $return="<li><a href=\"".$part1."/fr\">Fr</a></li>";
          $return.="<li><a href=\"".$link2."\">En</a></li>";
          } elseif($mode==="en") {
          $posen = strpos($_SERVER['PHP_SELF'],"/en/");
          $return="<li><a href=\"".$link."\">Fr</a></li>";
          $return.="<li><a href=\"".$part1."/en\">En</a></li>";
        } else {
                $return="<li><a href=\"/fr\">Fr</a></li>";
            $return.="<li><a href=\"/en\">En</a></li>";


        return $return;

I've make a switchLang.php file and when I want to make an include in header.php or another file, I've a white page instead of the site.

The other problem is that my flag button for switch is in the $logo_area in the bfa_header_config.php, so when I put the code :

<a href="<?php echo switchLang(\'fr\'); ?>"><img src="/flag.png"></a>
and when I mouse over the flag I see a link like : website.com/en/about/<?php echo switchLang('fr') ?> so, when I click it, I have a 404.

Can somebody help me to solve this problem?

Regards, Lyryanne =).

PS : Sorry for my poor English I'm French ^^.

All times are GMT -6. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.