I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Tips and Trick » How to Highlight the Selected Menu Item in Websites That Generated by PHPMaker 9.2.0
How to Limit Record Count Displayed in List Page of Websites that Generated by PHPMaker 9.2.0
Implementing autoNumeric jQuery Plugin in Websites that Generated by PHPMaker 9.2.0

April 13, 2013

How to Highlight the Selected Menu Item in Websites That Generated by PHPMaker 9.2.0

Now we are going to add the ability of highlighting the selected menu item in web applications that generated by PHPMaker. Actually the following trick below is similar to this topic in PHPMaker discussion forum. Unfortunately, that code will only work for the menu bar item which have sub-menu items beneath it. That code in the forum will not work if the menu item does not have any sub-menu item.

So, I modified the code in the forum above so that it will work for the menu items which do not have sub-menu items beneath it. The only limitation for the following trick below is it will only work for the selected menu item and its top-parent menu if the selected menu item has more than one parent menu. For example, when your web application user is selecting the menu item (let's say its name is My Target Menu that located under the My Root Menu -> My Category Menu location, then only My Root Menu and My Target Menu menu items will be highlighted, whereas My Category Menu won't be highlighted.

In addition, please note that the following trick below is only suitable for the Horizontal Menu layout. If you are using Vertical Menu layout, then the top-parent menu will not be highlighted when the sub-menu is selected (only the selected page menu will be highlighted).

  1. Copy the following code under the Client Scripts -> Global -> Pages with header/footer -> Startup Script:

    // This will highlight the current selected menu item and its top-parent (two-level menus):
    $('.yuimenuitemlabel').each(function(i) {
      menulabel = $(this).attr('href'); // get menu label
      if (menulabel == '<?php echo basename($_SERVER&#91;'PHP_SELF'&#93;); ?>') {
        $(this).closest('.yuimenubaritem').css('background-color', '#D0E6FF'); // parent menu
        $(this).closest('.yuimenuitem').css('background-color', '#D0E6FF'); // current menu item
        return false; // exit from each loop
      }
    });
    
    // This will highlight the current selected menu item which has no child menu (one-level menus only)
    $('.yuimenubaritemlabel').each(function(i) {
      menubarlabel = $(this).attr('href'); // get menu bar label
      if (menubarlabel == '<?php echo basename($_SERVER&#91;'PHP_SELF'&#93;); ?>') {
        $(this).closest('.yuimenubaritem').css('background-color', '#D0E6FF'); // current menu item
        return false; // exit from each loop
      }
    });
    
  2. From Tools -> Advanced Settings menu of PHPMaker, make sure you have enabled the Local YUI/jQuery files item.
  3. Finally, re-generate your script file using PHPMaker as always.

Article by Masino Sinaga / Tips and Trick / Client Script, css, highlight, horizontal menu, jQuery, menu, PHPMaker 9.2.0, selected menu, Startup Script, vertical menu Leave a Comment

How to Limit Record Count Displayed in List Page of Websites that Generated by PHPMaker 9.2.0
Implementing autoNumeric jQuery Plugin in Websites that Generated by PHPMaker 9.2.0

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2021 Project File Is Released
  • PHPMaker 2021 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2021 Is Released!
  • A New PHPMaker 2020 Project File Is Released
  • PHPMaker 2020 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2020 Is Released!
  • Inventory Stock Management Project, Why Should You Have It?
  • A New PHPMaker 2019 Project File Is Released!
  • PHPMaker 2019 Demo Project File Is Released!
  • Masino Extensions for PHPMaker 2019 Is Released!

Search

Recent Comments

  • saleh alayafi on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • saleh alayafi on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0

Demo Website

  • Demo of I Love PHPMaker 2021 (MasinoExtensions).
  • Indonesia Post Offices.
  • Stock Inventory Management.
  • Demo of PHPMaker + PHP Report Maker

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (3)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (79)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2019 by Masino Sinaga | WordPress | Log in | Back to top