Jump to:

5538 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Multiple Sidebar and Footer

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

Page: 1
Go to End
Author Topic: 854 Views
  • hunman
    Community Member
    18 Posts

    Multiple Sidebar and Footer Link to this post


    I need two sidebars, one on left and other on right in my template , also a footer bar in the bottom. I want to populate content in these sidebars and footer from the back-end only but not manually.

    Which is the best way to achieve this functionality ??? Please Help



  • Martijn
    Community Member
    271 Posts

    Re: Multiple Sidebar and Footer Link to this post

    Have you tried this?


    This method describes how to use a PageType to manage a single Sidebar thats the same across all pages..

    You can also use widgets to populate sidebars with pieces of custom content.

    An other way is to create a DataObject subclass and manage these with ModelAdmin. You can give these DataObjects a position field to decide where the DataObjects need to be shown.

    Simple example (not tested):

    class ContentBlock extends DataObject{
    static $db = array(
    'Title' = 'Varchar(255)',
    'Content' = 'HTMLText'
    'Position' = "'Left, Right, Top', 'Top'"

    in Page.php you create a method to get the ContentBlocks:

    function ContentBlocks($position = ''){
    return DataObject::get('ContentBlock', "Position='".$position."'");

    In your template:

    <% if ContentBlocks(Left) %>
    <div id="ContentLeft">
    <% control ContentBlocks(Left) %>
    <div class="contentblock">
    <% end_control%>
    <% end_if %>

    This does not cover the ordering of the contentblocks, but this should get you started.
    You can use DataObjectManager for example, to manage the ContentBlock DataObjects and add $sortable_class to the DataObject.

    Further reading:

    BTW: You don't need double posting here ;)

    Hope this helps.

  • hunman
    Community Member
    18 Posts

    Re: Multiple Sidebar and Footer Link to this post

    Hi Martijn,

    Thank you for your post, I think this will help me to achieve my task.

    Also I think the content order can be achieved by including another field say "order" and fetching the records based on this order.

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.