Jump to:

3393 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » How to hide a page type

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

Page: 1 2
Go to End
Author Topic: 2627 Views
  • iroy2000
    Avatar
    Community Member
    15 Posts

    How to hide a page type Link to this post

    Hi all,

    I created a page type called

    "BannerHolder" and "Banner".

    What I want is, I just want to include the "bannerHolder" into other page, but not a standalone page.

    But when I create that in the CMS, in my front end, I saw "Banner Holder" in my navigation.

    Is there anyway to hide the BannerHolder type from navigation???

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: How to hide a page type Link to this post

    Well you can untick 'ShowInMenu' for the page in the Behaviour tab in the CMS.

  • iroy2000
    Avatar
    Community Member
    15 Posts

    Re: How to hide a page type Link to this post

    LOLz, it's my bad. I removed the behavior field for that type..

    $fields->removeFieldFromTab("Root","Behaviour");

  • Garrett
    Avatar
    Community Member
    245 Posts

    Re: How to hide a page type Link to this post

    What I need to do is a step further -- I need a certain page type not to show in the site tree. I have two page types that both have a has_many relationship to third page type, the problem is that when the relationships are made and saved, a row is created in the relational table and so these relations themselves show up in the CMS as empty pages (of page type ProductPage_BusinessNeed). How can I specify in the CMS that these pages simply do not Show?

    Thanks,
    Garrett

    Attached Files
  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: How to hide a page type Link to this post

    If I understand you correctly, you really don't want them to be Pages at all, ever? Not as standalone Page in your Website, not in your create-page-dropdown in the CMS and notin the SiteTree?

    If that's the case you could very well use a DataObject instead of a page type, since a page is only a sophisticated DataObject anyway...

  • Garrett
    Avatar
    Community Member
    245 Posts

    Re: How to hide a page type Link to this post

    Thanks for your reply. Your assumptions are correct. However, I cannot use a DataObject because of that classic SS problem -- HTMLEditorField doesn't work in the modal popup -- and this page type must contain an HTML-friendly Content field. Any other ideas?

    Thanks again,
    Garrett

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: How to hide a page type Link to this post

    Depends on how HTML-friendly the thing is supposed to be, and what it's for.

    - If it is just, for instance to include some flash banner, or other 'semi-fixed' HTML you could and probably even should do that using your templates without need for a WYSIWYG at all.

    - I know the DataObjectManager module includes a number of simple HTML editors, that could work if your HTML content doesn't need all the ins and outs of the complete TinyMCE editor.

    - You could consider the use of ModelAdmin, although I'm not sure if including the TinyMCE field already works out of the box
    http://www.silverstripe.org/data-model-questions/show/4983

    But if you stick to using Pages, I really don't understand why you would want to keep them out of the CMS SiteTree, since there would be no way to ever edit/delete them at all...

  • Garrett
    Avatar
    Community Member
    245 Posts

    Re: How to hide a page type Link to this post

    The HTML I need would be links and paragraphs, and of course it's not fixed at all as the client will be populating these content fields. The reason I need to keep them out of the CMS SiteTree is because since a new instance of this third page type is created in the CMS every time a relationship is created between the other two page types, it is mucking up the CMS terribly as these pages don't have titles, not to mention there are several dozen of them. See the screenshot and you'll get it.

    It is too late for me to redesign it completely using ModelAdmin, though I erally would like to try extending that in the future. Meantime' I'll look into what other HTML fields are available in DataObjectManager.

    //Garrett

    Attached Files
    2627 Views
Page: 1 2
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.