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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

include a own sidebar in just one page section


Go to End


12 Posts   4170 Views

Avatar
Willr

Forum Moderator, 5523 Posts

23 February 2010 at 8:59am

NARKOZ you can try

<% if InSection(forum) || InSection(blog) %> 

If that doesn't work you'll need to move the logic to your PHP page controller.

Avatar
NARKOZ

Community Member, 25 Posts

23 February 2010 at 9:24am

to move the logic to your PHP page controller

Can you give me any documentation about this?

Avatar
Willr

Forum Moderator, 5523 Posts

23 February 2010 at 9:34am

Well its just writing pretty much the same thing, just in PHP rather than the template and passing a simple boolean answer.

In your mysite/code/Page.php, in either your controller or the model (both should work)

function HasSidebar() {
  return ($this->InSection('blog') || $this->InSection('forum'));
}

Then in the template you use <% if HasSidebar %>....

Avatar
NARKOZ

Community Member, 25 Posts

23 February 2010 at 10:24am

Thanks. It works.

Go to Top