Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » problem in code: hide sidebar in only one page

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

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

Page: 1
Go to End
Author Topic: 1321 Views
  • bebabeba
    Avatar
    Community Member
    192 Posts

    problem in code: hide sidebar in only one page Link to this post

    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>

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: problem in code: hide sidebar in only one page Link to this post

    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.

  • bebabeba
    Avatar
    Community Member
    192 Posts

    Re: problem in code: hide sidebar in only one page Link to this post

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

    1321 Views
Page: 1
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.