Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

content blocks


Go to End


9 Posts   3596 Views

Avatar
dreamstudio

Community Member, 48 Posts

4 March 2009 at 11:14am

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

Avatar
Willr

Forum Moderator, 5523 Posts

4 March 2009 at 1:35pm

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 %>

Avatar
dreamstudio

Community Member, 48 Posts

4 March 2009 at 7:30pm

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?

Avatar
Sam

Administrator, 690 Posts

4 March 2009 at 7:49pm

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);
  }
}

Avatar
dreamstudio

Community Member, 48 Posts

4 March 2009 at 9:47pm

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

Avatar
Carbon Crayon

Community Member, 598 Posts

4 March 2009 at 11:37pm

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 :)

Avatar
dreamstudio

Community Member, 48 Posts

4 March 2009 at 11:53pm

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?

Avatar
Carbon Crayon

Community Member, 598 Posts

5 March 2009 at 12:21am

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!

Go to Top