I am having trouble coming up with some logic. I have a site that has three color coded sections, and a bunch of ancillary pages outsides of those sections.
The sites main menu needs to change according to the section currently being viewed, and another menu displayed if the page is either the home page or some other ancillary page (about, contact, terms and conditions etc).
I have a snippet that can feed page ids into list out the required pages (with help from autoID) but i can seem to figure out the detection of the three sections, any page inside those sections, and else statement for all other pages.
Ok so ill try and break the problem down and maybe forget my attempt above. The page with id of 65 is the top level page for that section in the site root. that was me trying to get the menu to work on the parent page and any descendent of it. 65 id is the page with a uid of sectiona.
The site essentially has 4 different main menus. A unique menu for each of the 3 sections. The pages in the unique menus are controlled by that snippet above with the array of specific IDs.
Any page in section 1 including the top level parent page gets menu 1
Any page in section 2 including the top level parent page gets menu 2
Any page in section 3 including the top level parent page gets menu 3
Any page that doesn’t fit into the above gets menu 4 (Home page, contact page, error page etc) - these pages are not necessarily top level. The about page is top level but has a few child pages, and some grandchildren… they should all get menu 4, regardless of depth.
@jimbobrjames:
You can give each page a field, that stores the number of the menu, its belongs to.
Then in the template, you know which menu you want to show.
I don’t really want to go there … this is an existing site I am updating and has close to 200 pages in it. In the time it takes me to add all the fields to the pages i could have figured out the logic that didnt need it…