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:

Archive /

Our old forums are still available as a read-only archive.

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

problem in code: hide sidebar in only one page


Go to End


3 Posts   1725 Views

Avatar
bebabeba

Community Member, 193 Posts

13 November 2008 at 10:25pm

hi!
I try to hide sidebar in only onde page. Sidebar show, at right, the second level menu, for that page. In ArticleHolder page I want hide this second level menu. So I try to do in this way, but someting is wrong, can you help me?
I want underline that in brackets I put "ArticleHolder": this is the name of "ArticleHolder.php" file, not the url oh page that is "result"

<div id="sidebar" >
<% if Page(ArticleHolder)%>
<% if Menu(2) %>
<div class="sidebox">empty</div>
<% end_if %>
<% else %>
<% if Menu(2) %>
<div class="sidebox">
<h1 class="clear"><% control Level(1) %>
$Title
<% end_control %>
</h1>
<ul class="sidemenu">
<% control Menu(2) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode<% if First %> top<% end_if %>"><span>$MenuTitle</span></a></li>
<% end_control %>
</ul>
</div>
<% end_if %>
<% end_if %>
</div>

Avatar
Liam

Community Member, 470 Posts

14 November 2008 at 6:41am

Use either <% if InSection(page-url) %> to check the specific page, or if you want to check for all page types, use <% if ClassName = ArticleHolder %> - this would return true for every page that uses article holder.

Avatar
bebabeba

Community Member, 193 Posts

14 November 2008 at 8:35pm

Thanks, I try your solution with Classname and it's ok!