Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

page control to list all pages


Reply


5 Posts   2779 Views

Avatar
Amir Mostofi

Community Member, 59 Posts

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?’.

Avatar
Ben Gribaudo

Community Member, 181 Posts

18 April 2009 at 1:40am

Edited: 18/04/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

Avatar
Amir Mostofi

Community Member, 59 Posts

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.

Avatar
motoservo

Community Member, 24 Posts

19 April 2009 at 4:52pm

Why not just pass a message to DataObject::get to get all objects of type 'Page'?

Avatar
Ben Gribaudo

Community Member, 181 Posts

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.