Jump to:

3397 Posts in 978 Topics by 854 members

Template Questions

SilverStripe Forums » Template Questions » Extending a Basic Site - fundamental errors?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1035 Views
  • arthurdent
    Avatar
    Community Member
    132 Posts

    Extending a Basic Site - fundamental errors? Link to this post

    I'm calling it a fundamental error because I've probably made a fairly basic mistake but I can't see it... I want to add a 'news' type section to a site that I am building, as per the following tutorial:

    http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-site#creating_the_news_section_page_types

    I have created the mysite/code/ArticlePage.php and mysite/code/ArticlePage.php pages, then gone on to create the themes/tutorial/templates/Layout/ArticlePage.ss and themes/tutorial/templates/Layout/ArticleHolder.ss pages. Thinking I can fine-tune these pages later and remove anything that I don't want, I have done a straight cut and paste from the tutorial. I have rebuilt the database http://localhost/dev/build?flush=1 - and as far as I can see, having read and re-read the tutorial, that should be it. Sure enough, the ArticleHolder and ArticlePage page types have appeared in the CMS. I have set the parent page type as 'ArticleHolder' and set up an 'ArticlePage' as a test.

    However the parent 'ArticleHolder' page is not displaying the children pages?!

    Have I missed something fairly basic?

  • arthurdent
    Avatar
    Community Member
    132 Posts

    Re: Extending a Basic Site - fundamental errors? Link to this post

    OK, I've investigated further and found out that the sub-page DOES show in the list when I check the 'show in menus' box in the CMS. However I don't want these subpages to appear in the site navigation! If I had wanted them to appear in the navigation I wouldn't be setting up these pages as ArticleHolder is already a list of subpages! As I said, it's a very fundamental error! So can anybody offer a work-around here?

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Extending a Basic Site - fundamental errors? Link to this post

    By default all control loops will filter for 'Show In Menus' if this is unticked it will hide them - as you have found out. The way to do this is to tick the box so that they aren't in the navigation but in the template use the control <% control AllChildren %> instead of <% control Children %> in your holder page. AllChildren ignores the show in menus.

  • arthurdent
    Avatar
    Community Member
    132 Posts

    Re: Extending a Basic Site - fundamental errors? Link to this post

    To my rescue again Will! Reckon I owe you a beer or two -- thanks!!

    1035 Views
Page: 1
Go to Top

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

Comments on this website? Please give feedback.