Sometimes, you want to hide all the menu items for all pages in your web applications that generated by PHPMaker. You can do this easily and quickly in PHPMaker by using jQuery. This trick will let you know how you can remove the menu section in your web application that generated by PHPMaker without having to customize the generated files. All you have to do is by writing only two lines of jQuery code from Client Scripts section of PHPMaker, afterwards just generate your script files.
Updated on February 10, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
To add the related code, just follow these steps:
- Open your PHPMaker project (.pmp) file using PHPMaker
- In order to use the local jQuery file instead of the live one (I always strongly recommend it for you), then make sure you have given a checked mark at Local YUI/jQuery files from Tools -> Advanced Settings menu of PHPMaker.
- Now let's go to the code part. Click on one of your tables from the Database (left) pane in order to display the Client Scripts section.
Click on Code (Server Events, Client Scripts and Custom Templates) tab, and then expand the following location: Client Scripts -> Global -> Pages with header/footer -> Startup Script, then copy and paste the following code:
As you can see from the code above, we have to handle the possibility of Horizontal and Vertical menu. This is important, since PHPMaker supports for displaying menu using either horizontal or vertical style. So don't forget to handle those possibilities.
- Finally, re-generate your script files using PHPMaker as always.
Just for your information, you can check that code from your generated footer.php file (have a look at the bottom of the file).