Set Page attribute and child pages?
Permalink
Hi Team
Here is one for you to have a look at. I am using the Amiant CSS3 Menu.
Now this works but what i want is the ability, to not display the active page dropdown menu. As I have a second menu for these which is underneath so no dropdown need on the active page.
there is a page attribute- do_not_display_subpages_in_nav which i need to set on the active page. So no dropdown is displayed. However I also need to set child pages with this attribute as these also have sub pages displayed in the menu.
I have it setting the current page attribute.
And I am trying to set the child pages also but i am getting a little lost?
I this code dont work i was guessing.
Can i modify the attribute do_not_display_subpages_in_nav to effect all sub pages or create a new one, which covers all sub pages?
Also how do I reset the attribute once they leave the relevant section to display the dropmenu again?
I was thinking i could create a new attribute for each page and add it into the code so each page has its own attribute?
[code][/code]
Any Ideas or help
Thanks
Carl
Here is one for you to have a look at. I am using the Amiant CSS3 Menu.
Now this works but what i want is the ability, to not display the active page dropdown menu. As I have a second menu for these which is underneath so no dropdown need on the active page.
there is a page attribute- do_not_display_subpages_in_nav which i need to set on the active page. So no dropdown is displayed. However I also need to set child pages with this attribute as these also have sub pages displayed in the menu.
I have it setting the current page attribute.
$page = Page::getCurrentPage(); $page->setAttribute('do_not_display_subpages_in_nav', '1');
And I am trying to set the child pages also but i am getting a little lost?
I this code dont work i was guessing.
$children = $page ->getCollectionChildrenArray(1); foreach ($children as &$value { $value->setAttribute('do_not_display_subpages_in_nav', '1'); }
Can i modify the attribute do_not_display_subpages_in_nav to effect all sub pages or create a new one, which covers all sub pages?
Also how do I reset the attribute once they leave the relevant section to display the dropmenu again?
I was thinking i could create a new attribute for each page and add it into the code so each page has its own attribute?
[code][/code]
Any Ideas or help
Thanks
Carl