The Rule form: Menu Handling

(0 votes, average 0 out of 5)

4-cham-menu-handling-form-b

1. Menu Item Handling

Although the standard Joomla Template Manager already allows you to assign template to menu items, this control gives you a lot more options. For example, you can select an entire menu (e.g. “Main Menu”), and this will then automatically include every menu item inside that menu, even if more items are added in the future. You can also choose to exclude certain menu items, or include all the children (sub-menus) of a given parent menu item.

Options:

  • Include selected Items
  • Include selected items and their children
  • Include only children of selected items
  • Exclude selected items
  • Exclude selected items and their children
  • Exclude only children of selected items

Usage Example:

You may want to use template "Beez 20" for all sub-menus of "Using Extensions" in the screenshot above. If this is not the default template on your site, then someone adding new sub-menu items below that menu item would have to remember to manually assign the "Beez 20" template to each new menu item they create.

With Chameleon, all you need to do is select "Using Extensions" from the list above, and set the dropdown to "Include selected items and their children". Then any new menu items created below that menu item will automatically be displayed using the "Beez 20" template.

2. Menus and Menu Items

Choose the menus or menu items to include/exclude for this rule to SUCCEED. You can select more than one by holding down the CTRL key (Windows) or Command key (Mac).

The top (default) item on the list is #Ignore# which you should use if you don’t want to detect any menus / menu items.

3. Menu item note search

Using this control you can make the rule SUCCEED or FAIL depending on the "note" attached to the menu item. The rule will SUCCEED if the current menu item has a note matching the text and condition entered here.

Options:

  • equals
  • contains
  • starts with
  • ends with
  • matches regex
  • does not equal
  • does not contain
  • does not start with
  • does not end with
  • does not match regex
  • is in list
  • is not in list

The comparisons are case insensitive. "lists" are comma-separated phrases, and the note must match one of the phrases in order to succeed. Regex patterns must include delimiters e.g. /searchstring/

Usage example:

  • You want to ban users from a certain country from certain pages, and redirect them to an error page
  • The list of "banned" pages changes regularly, but you don't want to have to edit the list in Chameleon all the time – you would rather handle it in the Menu Manager by adding a "note" to the banned pages. Then you can see the notes (and see that it's a banned page) in the list of menu items, as the notes are visible.
  • Add the note "Ban it" to all the affected menu items
  • Make a Chameleon rule that detects 2 things:
    1. the GeoIP country you want to ban
    2. "Menu item note search contains Ban it"
  • In the Succeed action, redirect to your error page.

By doing this, any time someone from the banned country visits a page, Chameleon checks to see if that menu item has the note "Ban it". If it does, the rule succeeds and the user is redirected to the error page.

Last Updated on Wednesday, 15 July 2015 04:09