Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Sidebar content/editable regions help (please)

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

Page: 1 2
Go to End
Author Topic: 3532 Views
  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Sidebar content/editable regions help (please) Link to this post

    I take it in this case the file I am working with is "mysite/code/HomePage.php"?

    Yes, if you only want this region for the homepage then you will just use the HomePage.php file. Copy the $db array and getCMSFields() from the code I posted and use that in the HomePage.php

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Sidebar content/editable regions help (please) Link to this post

    Terrific Will -- that cracked it!! Thanks heaps!!

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Sidebar content/editable regions help (please) Link to this post

    Revisiting the post to try to get an editable sidebar working in SS3...

    Discovered that "Root.Content.Sidebar" is deprecated in Version 3. PHP code needs to change to the following...

    <?php

    class Page extends SiteTree {

    static $db = array(
    'SidebarHTML' => 'HTMLText'
    );

    static $has_one = array(
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Sidebar", new HtmlEditorField( "SidebarHTML"));
    return $fields;

    }

    }

    class Page_Controller extends ContentController {

    }
    ?>

    Hopefully this will help others in a similar predicament!

  • arthurdent
    Avatar
    Community Member
    152 Posts

    Re: Sidebar content/editable regions help (please) Link to this post

    Just one thing weird I've noticed -- the CMS doesn't seem to appreciate my efforts very much. However all page content is written to DB and a refresh solves the CMS interface issues... however it gets pretty ugly for a moment!

    Anybody have any ideas about what's going on?

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