Jump to:

5452 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » custom template

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

Page: 1
Go to End
Author Topic: 795 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    custom template Link to this post

    Hi

    When I want to create new template I always extend Page, wich goes with a "content " tab on the HTML editor.
    I also know how to create another Tab by insterting a new html field in my template.

    My problem is now the following :

    I Need to create another template with a content Tab but I don't want it to be the "original" content tab but a spécific one.

    How can I do that without rmoving it from Page wich I presume would remove it everywhere

    Thanks for any clue

    T

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: custom template Link to this post

    The easiest solution would be to extend page, which would create a whole corresponding template (or Layout) and you can customize the contents of the DataObject.

    This will not affect your existing Page types and you can add any kind of data types to the $db array to suit your needs.

    Read up here, starting with the Adding Date and Author Fields
    http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-site

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: custom template Link to this post

    Thanks

    BUt that keeps the content tab always does it ?

    T

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: custom template Link to this post

    Yes, but it will be a separate table that will not interfere with your existing pages.

    Content is merely an DataObject $db variable named Content of type HTMLText ('Content' => 'HTMLText'). Whenever you throw a type HTMLText to the CMS it will give you the WYSIWYG editor.

    If you don't want one, create a new Page type and controller that extends SiteTree instead of Page, then you can start from scratch.

    If that sounds too complicated, just do the following:

    function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->removeByName('Content');
       return $fields;
    }

    795 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.