17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1192 Views |
-
Displaying pages where "Show in menus?" unticked

22 October 2007 at 2:42pm
Hello,
On my current project I have created Staff Pages. Instead of clicking these items for more details, i am listing all details in the template for the Page Holder. Becauce of this, I do not want these items to list in the menu at the side of the page.
However if I untick the "Show in menus?" option for each page, the details are not shown by the Page Holder template. I am using <% control Children %> to iterate through each of the Staff pages.
Can anyone assist?
Cheers,
Gary
-
Re: Displaying pages where "Show in menus?" unticked

22 October 2007 at 8:11pm Last edited: 22 October 2007 8:16pm
Hi there,
By default, Children displays pages if the field ShowInMenus is 1.
You can override this behaviour by making your own custom control. On the class for your staff pages, or on Page (dependent on how you've setup your project), you can make a function like this:
function StaffPages() {
return DataObject::get('StaffPage', "ParentID = $this->ID");
}Then replace <% control Children %> with <% control StaffPages %> - bear in mind this is assuming you have StaffPage page types assigned to your staff pages. Just change the first parameter to 'Page' if you want to get any page type as children instead.
Hope this helps!
Cheers,
Sean -
Re: Displaying pages where "Show in menus?" unticked

22 October 2007 at 8:50pm
Thanks as always, Sean!
| 1192 Views | ||
|
Page:
1
|
Go to Top |


