Multi-language function

4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 15, 2014   (RSS)

By ht1080z - May 7, 2014

Dear interactiveTools Team,

I use a custom php function to control the languages in our websites. In the following example in Greek and English.

inc/languages.php :

<?php
    $a = session_id();
    if ($a == '') session_start();
    if (!isset($_SESSION['language'])) {
        session_regenerate_id(true);
        $_SESSION['language'] = "gr";
    }
    $_SESSION['sessionid'] = session_id();
?>

in every page header :

  require_once 'inc/languages.php';
  if (@$_REQUEST['lang']) { 
    if (@$_REQUEST['lang'] == "en") { $_SESSION['language'] = "en"; }
    elseif (@$_REQUEST['lang'] == "gr") { $_SESSION['language'] = "gr"; }
  }

and for each language i get content from the database :

<?php echo $blogRecord['title_'.$_SESSION['language']]; ?>

for i previously create title_en and title_gr in the related tables in the cms.

The above solution is working, but maybe you have any suggestion to improve / upgrade it.

Thank you in advance,
Karls

By ht1080z - May 15, 2014

Thank you for your addition Damon.

Is there any other multi-language solution is out there that works great with cmsBuilder?

Karls

By Damon - May 15, 2014

Hi Karls,

Here is a forum thread that discusses multi-language options and ideas:
http://www.interactivetools.com/forum/forum-posts.php?postNum=2193269#post2193269

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/