What Sothink DHTML Menu Can Do for You?

 

Download Sothink DHTML Menu



Multiple Languages

Sothink DHTML Menu :
Same menu for all languages by using variables in the item text

Part 1: Overview
If you manage a multi-lingual site and use DHTMLMenu to create guide menu, it's a annoying work to make a same dhtml menu in deferent language. But now you can use variables to create one menu for all languages.

In this example, we create only one menu, but it can show in English and French language.

Part 2: Steps
The following are the steps of this example:

  1. In the DHTML Menu program, check HTML button, and input <?php echo($strMenuText); ?> in the text field, and do uncheck "Encode special characters" in the advanced of Global Settings.
  2. Insert the menu code into the php page.
  3. Add following script in the page's body code:
    <?php
    define("LANGUAGE_ENGLISH", 0);
    define("LANGUAGE_FRENCH", 1);
    $nLanguage = LANGUAGE_ENGLISH;
    $strMenuText = "";
    switch($nLanguage)
    {
    case LANGUAGE_ENGLISH:
    $strMenuText = "Hello";
    break;
    case LANGUAGE_FRENCH:
    $strMenuText = "bonjour";
    break;
    default:
    $strMenuText = "Hello";
    break;
    }
    ?>
  4. Save your page and check it in browser.
    (Note: your server should support PHP.)

 

Part 3: Code Explanation
This is the source code at the beginning of this sample page.

Code

Explanation

<?php
define("LANGUAGE_ENGLISH", 0);
define("LANGUAGE_FRENCH", 1);
Define macro.
$nLanguage = LANGUAGE_ENGLISH;
$strMenuText = "";
Define two variables: "nLanguage" and "strMenuText".

switch($nLanguage)
{

case LANGUAGE_ENGLISH:
$strMenuText = "Hello";
break;
case LANGUAGE_FRENCH:
$strMenuText = "bonjour";
break;
default:
$strMenuText = "Hello";
break;

}
?>

Set to show the corresponding language in which condition.
Home

Sothink is a trademark of SourceTec Software Co., LTD.
Sothink Software: SWF Decompiler Flash to HTML5 Logo Maker Flash Banner Maker Drop Down Menu Video Converter

1234