3212 Posts in 847 Topics by 809 members
| Go to End | Next > | |
| Author | Topic: | 2448 Views |
-
include a own sidebar in just one page section

21 September 2009 at 7:52pm
hello,
I have a question about a own sidebar (not the blog sidebar).
For example:
I have the following pages in my cms:
Home
News
ContactSo, I ceated a sidebar and I want this sidebar only include in the news section, and also on all sublinks from the news section.
My question is now how I can include the sidebar and tell silverstripe its just to show on news (and sublinks from news).
My sidebar file is called "NewsSidebar.ss"I hope you can understand my question and I hope I posted in the right forum,
regards from germany. -
Re: include a own sidebar in just one page section

21 September 2009 at 9:59pm
You could do
<% control Level(1) %>
<% if Title = News %>
... show sidebar
<% end_if %>
<% end_control %> -
Re: include a own sidebar in just one page section

22 September 2009 at 1:28am
hi,
thanks for your answer..
but what is about the sub pages of "News".. they have other titles, so the sidebar would not be included, right? -
Re: include a own sidebar in just one page section

22 September 2009 at 1:57am
I think you can use the InSection-control for that.
-
Re: include a own sidebar in just one page section

22 September 2009 at 3:27am
I searched for "In section control" in the silverstripe docu ( http://doc.silverstripe.org/doku.php ), but I found nothing about it.
so, could you please tell me more about that function?
-
Re: include a own sidebar in just one page section

22 September 2009 at 1:29pm
"News".. they have other titles, so the sidebar would not be included, right?
No because that code is controlling over the Level(1) it returns the titles of the top most level pages.
InSection would work well for this - http://doc.silverstripe.com/doku.php?id=built-in-page-controls&s=insection.
<% if InSection(blog) %>
....
<% end_if %> -
Re: include a own sidebar in just one page section

22 September 2009 at 8:10pm
thanks, that works how I wanted.
-
Re: include a own sidebar in just one page section

22 February 2010 at 10:39pm
Hi. Thanks.
How can I do this for different pages. I guess, for forum and blog pages something like:
<% if InSection(forum) or InSection(blog) %>
$Layout
<% else %>
<div id="main">
$Layout
</div>
<% include SideBar %>
<% end_if %>but it doesn't work and gives me error.
| 2448 Views | ||
| Go to Top | Next > |



