Warning: Undefined array key "pn" in /usr/home/frames/public_html/likno/examples/menuvariables.php on line 51

 

Menu Variables Example

This php page demonstrates how a different text can appear on the menu by using "custom variables" instead of literal text strings.

The text on the 1st item is controlled by a custom variable, declared as <awm:productname> on its <Text> property. Default string for the variable is "AllWebMenus". Through javascript code you can assign a different string to the productname variable which overrides the default one.

If you click here the page will be called with the parameter "?pn=1", which then assigns the "AllWebMenus Pro" string to the productname variable.

If you click here the page will be called with the parameter "?pn=2", which then assigns the "AllWebMenus Lite" string to the productname variable.



Download this AllWebMenus project file.


Note: "php" serves as example only, custom variables can be used with any environment!

FYI, below is the php code that interprets the parameter and assigns the related value to the javascript variable:

<?
$pn = $_GET['pn'];
   switch ($pn) {
   default:
           $pn = "AllWebMenus";
   break;
   case "1":
           $pn = "AllWebMenus Pro";
   break;
   case "2":
           $pn = "AllWebMenus Lite";
   break;
   }
   echo "<script type='text/javascript'>var productname = '$pn';</script>";
?>

For more info on setting up custom variables please read the related topic in AllWebMenus Help.