Jump to:

23550 Posts in 19336 Topics by 2890 members

General Questions

SilverStripe Forums » General Questions » content blocks

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 2062 Views
  • dreamstudio
    Avatar
    Community Member
    48 Posts

    content blocks Link to this post

    I read on a very old forum thread that content blocks werent possible then... however is it possible now with the new version of silverstripe to have content blocks that can be used throughout the site. ie in a section it could have a right hand block thats repeated throughout that section and then on another section different blocks. Without having to edit every page to update those blocks

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: content blocks Link to this post

    No you still can't do that out of the box. One of the ways if you have a parent page with the content block just do this in your template

    <% control Level(1) %>
    $SomeContent
    <% end_control %>

    I think that should always return the $SomeContent from the topmost parent page. If you what to have content site wide then you can just put the content on the homepage and do this in the template.

    <% control Page(home) %>
    $SomeContent
    <% end_control %>

  • dreamstudio
    Avatar
    Community Member
    48 Posts

    Re: content blocks Link to this post

    so would it be possible to do extra pages that have very small content... like a little box with some text in... that isnt visible or live on the site but is called from sections of the site... so page_awards has a small 200 wide box with a graphic in.. or graphic and text. this page isnt in the navigation or viewable anywhere BUT on all or certain parts of the site its called using the method you listed and it places that box in a place we specify in the template?

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: content blocks Link to this post

    Well, I would recomend that you create a custom page type and set ShowInMenus and ShowInSearch to false in the that page type's defaults. Here's a quick example:

    class SnippetPage extends Page {

    static $defaults = array(
    'ShowInMenus' => 0,
    'ShowInSearch' => 0,
    );

    }

    class SnippetPage_Controller extends Page_Controller {
    function index() {
    return new HTTPResponse("<p>This page isn't supposed to be visited</p>", 404);
    }
    }

  • dreamstudio
    Avatar
    Community Member
    48 Posts

    Re: content blocks Link to this post

    Sounds like that might solve that issue... so if you looked at these two designs
    home http://www.dreamstudio.co.uk/clients/dgs/design5greenblue.jpg
    inside page http://www.dreamstudio.co.uk/clients/dgs/inside.jpg

    Would you think that silverstripe would be able to have a site lokoing like that .... I can see the navigation shouldnt be a problem, left side underneath navigation ie quick contact can be fixed content and then the right side under the picture is the content blocks we wanted.

    Is this possible in silverstripe.. I hope so as I havefallen in love with how it works and cant wait to start using it

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: content blocks Link to this post

    Hi Dreamstudio

    There is absolutely no reason why you can't achieve that design. This tread should help you achieve block elements for your pages, in the same way that sam suggested.

    This is quite a regular request so I am going to put together a proper tutorial for it very soon

  • dreamstudio
    Avatar
    Community Member
    48 Posts

    Re: content blocks Link to this post

    That is excellent news.. so if i had a custom page for say... calendar and put the information on that... then called that content in the template on the right side it should work as i want...

    This would enable them to then edit a page ie calendar on the left side list and change it so it changes throughout all the sections its showing on the right hand side?

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: content blocks Link to this post

    Exactly Thats the beauty of silverstripe, moving data between pages is very simple and elegant, you could create a whole site out of psudo pages very easily if you wanted to!

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