PHPMaker only allows you to use one of the two menu layout when you generate the script, whether to use Horizontal or Vertical menu layout in one occasion. That is, when you first generate the script using the Horizontal menu layout, in the future you decide you want to switch using Vertical layout menu, then you have to re-generate the script by changing the existing menu layout from Horizontal to Vertical from the menu "Tools" -> "Extensions" -> "Graphical" -> "Advanced" tab in the application PHPMaker. It is very inefficient, isn't?
The following modification will solve these problems through the help of a fairly constant setting that can be changed from its configuration file. In other words, each time you want to switch from one layout to another, then you will quite simply change a parameter that defined in "ewcfg8.php" file without having to re-generate related script menu. Your site will support for using both Horizontal or Vertical menu based on the related constant value in your configuration file.
Updated: This modification has been tested and works fine also for the latest version, PHPMaker 8.0.3 on August 27, 2011.
All we have to do is customizing PHPMaker template files. In other words, we will not modify the generated script files.
Please click on the following image to watch the demo:
[hidepost]
- Please backup your related files before doing any modification below!
-
Open your Script\ewcfg.php file, and find this code:
// General
before the line of that code, please insert this following code:
// Begin of modification by Masino Sinaga, April 10, 2011 define("EW_MENU_HORIZONTAL", TRUE, TRUE); // Set the second parameter to TRUE if you want to use horizontal, or FALSE if you want vertical menu. // End of modification by Masino Sinaga, April 10, 2011
-
Open your \extensions\Graphical\ewmenu.php, and find this code:
<!--## If bHorizMenu Then ##--> var RootMenu = new YAHOO.widget.MenuBar("RootMenu", { autosubmenudisplay: true, hidedelay: 750, lazyload: true }); <!--## Else ##--> var RootMenu = new YAHOO.widget.Menu("RootMenu", { position: "static", hidedelay: 750, lazyload: true }); <!--## End If ##-->
then replace with this following code:
<?php if (EW_MENU_HORIZONTAL) { // Begin of modified by Masino Sinaga, April 10, 2011 in order to support horizontal dan vertical menu ?> var RootMenu = new YAHOO.widget.MenuBar("RootMenu", { autosubmenudisplay: true, hidedelay: 750, lazyload: true }); <?php } else { ?> var RootMenu = new YAHOO.widget.Menu("RootMenu", { position: "static", hidedelay: 750, lazyload: true }); <?php } // End of modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu ?>
-
Open your \extensions\Graphical\ewmenucfg.php file, and find this code:
// Menu <!--## If bVertMenu Then ##--> define("EW_MENUBAR_CLASSNAME", "yuimenu", TRUE); define("EW_MENUBAR_ITEM_CLASSNAME", "yuimenuitem", TRUE); define("EW_MENUBAR_ITEM_LABEL_CLASSNAME", "yuimenuitemlabel", TRUE); <!--## End If ##--> <!--## If bHorizMenu Then ##--> define("EW_MENUBAR_CLASSNAME", "yuimenubar yuimenubarnav", TRUE); define("EW_MENUBAR_ITEM_CLASSNAME", "yuimenubaritem", TRUE); define("EW_MENUBAR_ITEM_LABEL_CLASSNAME", "yuimenubaritemlabel", TRUE); <!--## End If ##-->
then replace with this following code:
// Menu // Horizontal if (EW_MENU_HORIZONTAL) { // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu define("EW_MENUBAR_CLASSNAME", "yuimenubar yuimenubarnav", TRUE); define("EW_MENUBAR_ITEM_CLASSNAME", "yuimenubaritem", TRUE); define("EW_MENUBAR_ITEM_LABEL_CLASSNAME", "yuimenubaritemlabel", TRUE); } else { // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu // Vertical define("EW_MENUBAR_CLASSNAME", "yuimenu", TRUE); define("EW_MENUBAR_ITEM_CLASSNAME", "yuimenuitem", TRUE); define("EW_MENUBAR_ITEM_LABEL_CLASSNAME", "yuimenuitemlabel", TRUE); } // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu
-
Open your \extensions\Graphical\ewmenuext.php file, and find this code:
<!--##session menu_top##--> <!--## If bHorizMenu Then ##--> <div class="ewMenuRow"> <!--## End If ##--> <!--## If bVertMenu Then ##--> <!-- content (begin) --> <table cellspacing="0" class="ewContentTable"> <tr> <td class="ewMenuColumn"> <!-- left column (begin) --> <!--## End If ##--> <!--##/session##--> <!--##session menu_bottom##--> <!--## If bHorizMenu Then ##--> </div> <!-- content (begin) --> <table cellspacing="0" class="ewContentTable"> <tr> <!--## End If ##--> <!--## If bVertMenu Then ##--> <!-- left column (end) --> </td> <!--## End If ##--> <!--##/session##-->
then replace with this following code:
<!--##session menu_top##--> <?php if (EW_MENU_HORIZONTAL) { // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu ?> <div class="ewMenuRow"> <?php } else { ?> <!-- content (begin) --> <table cellspacing="0" class="ewContentTable"> <tr> <td class="ewMenuColumn"> <!-- left column (begin) --> <?php } // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu ?> <!--##/session##--> <!--##session menu_bottom##--> <?php if (EW_MENU_HORIZONTAL) { // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu ?> </div> <!-- content (begin) --> <table cellspacing="0" class="ewContentTable"> <tr> <?php } else { ?> <!-- left column (end) --> </td> <?php } // Modified by Masino Sinaga, April 10, 2011 in order to support horizontal and vertical menu ?> <!--##/session##-->
[/hidepost]
Leave a Reply
You must be logged in to post a comment.