Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

1598 Posts in 399 Topics by 403 members

Template Questions

SilverStripe Forums » Template Questions » page control to list all pages

Page: 1
Go to End
Author Topic: page control to list all pages 794 Views
  • Amir Mostofi
    avatar
    Community Member
    59 posts

    page control to list all pages Link to this post

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

  • Ben Gribaudo
    avatar
    Community Member
    181 posts

    Re: page control to list all pages Link to this post

    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

  • Amir Mostofi
    avatar
    Community Member
    59 posts

    Re: page control to list all pages Link to this post

    I had a feeling that you had to define your own controller. Ben thank you for confirming that and the suggestion.

  • motoservo
    avatar
    Community Member
    23 posts

    Re: page control to list all pages Link to this post

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

  • Ben Gribaudo
    avatar
    Community Member
    181 posts

    Re: page control to list all pages Link to this post

    Good question! That might work. I'm not sure if original poster wants all pages on the site or just all level one pages.

    794 Views
Page: 1
Go to Top

Currently Online: There is nobody online.

Welcome to our latest member: Newclear

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.