Search code examples
phpfootermultilingual

Footer or header in different language with php


I'm using the elxis cms to create a website. The site is in two languages, English and Russian. I want in the index.php to have some html code in footer which will be different for each language. For example I will show my address and contact information and I want it to show in English if the site visitor choose as his language the English. I wonder is there any php code to that? something like

<?php 
        if ($lang=en {
            echo '< footer in english>

        if ($lang=ru {
            echo '< footer in russian> ?>

I have seen on an xml file a code which look like

<col lang="en"><![CDATA[.....]]></col>

Is there something equal for php??


Solution

  • You could make a URL which looks like this:

    http://Example.com/index.php?lang=en

    for the english site, and this:

    http://Example.com/index.php?lang=ru

    for the russian site,

    Then use some php like this:

    <?php 
        if($_GET["lang"] == "en"){
            echo '<footer in english>';
        elseif($_GET["lang"] == "ru"){
            echo '<footer in russian>';
        };
    ?>
    

    I used this on my website and for me it worked well.

    p.s. sorry for my bad english :)