2863 Posts in 731 Topics by 699 members
Template Questions
SilverStripe Forums » Template Questions » page control to list all pages
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1845 Views |
-
page control to list all pages

17 April 2009 at 12:10pm
I have a simple question. Is there a page control that can be used to list all the pages within the CMS whether the option ‘show in menus?’ is checked/unchecked in the tab panel behaviour?
What I'm after is something like <% control menu(1) %> which lists all level 1 pages which have ‘show in menus?’ checked. Instead I want a control that lists all pages regardless of the state of ‘show in menus?’.
-
Re: page control to list all pages

18 April 2009 at 1:40am Last edited: 18 April 2009 1:41am
Hello,
I guess you could start by doing a DataObject::get that fetches the top-level pages (those with a ParentID == 0), then use AllChildren() to get their children, as desired.
(AllChildren() works just like Children() except that it includes the "don't show in menu" children in its output. You can use it just like Children(), for example: <% control AllChildren %>).
Hope this helps,
Ben -
Re: page control to list all pages

18 April 2009 at 4:36am
I had a feeling that you had to define your own controller. Ben thank you for confirming that and the suggestion.
-
Re: page control to list all pages

19 April 2009 at 4:52pm
Why not just pass a message to DataObject::get to get all objects of type 'Page'?
-
Re: page control to list all pages

21 April 2009 at 5:54am
Good question! That might work. I'm not sure if original poster wants all pages on the site or just all level one pages.
| 1845 Views | ||
|
Page:
1
|
Go to Top |


