Jump to:

1383 Posts in 492 Topics by 521 members

Themes

SilverStripe Forums » Themes » New Page Type w/ Edittable Sidebar in CMS

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 972 Views
  • Dolza
    Avatar
    Community Member
    10 Posts

    New Page Type w/ Edittable Sidebar in CMS Link to this post

    I have everything in here working except displaying the contents of the sidebar itself, i think i am missing some basic functionality of how the variables are passed.

    My Page:

    <?php

    class PageWSidebar extends SiteTree {
       
       public static $db = array("SideBar" => "HTMLText"
       );
       
       public static $has_one = array("SideBar" => "HTMLText"
       );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main', new HTMLEditorField ('SideBar', 'SideBar Content'));
    return $fields;
    }
       
    }

    class PageWSidebar_Controller extends ContentController {
       
       public function init() {
          parent::init();

          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
       }

    }

    ?>

    and in my Theme I just have

    <div class="foo"> $SideBar </div>

    there's no errors, it just doesn't show anything that i type into the field in the cms

  • Dolza
    Avatar
    Community Member
    10 Posts

    Re: New Page Type w/ Edittable Sidebar in CMS Link to this post

    I had to make it's parent Page, not the tree, so problem solved.

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