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.

Archive /

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

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

How to do a "Main Menu" with childrens


Go to End


2 Posts   1456 Views

Avatar
Axl Rose

Community Member, 7 Posts

29 September 2008 at 8:30am

Edited: 29/09/2008 8:59am

I'am modifing the BlackCandy template, and I want to have a sidebar with ALL sections (home, information, photos, ecc) in every section (not just sidebar "about us" on "about us" section). Something like this:

Home
Information
-History
-Biography
Photos
-Axl
-Slash
Contact

I can do that, but when I have a 3rd level (for example, Information->Biography->Axl) it doesn't show (It should be shown only when someone clicks on "Biography").

EDIT: I've just got it. Here's the code:

<div id="Sidebar" class="typography">
	<div class="sidebarBox">
	  <% control Menu(1) %>
		  <h3>
			<% control Level(1) %>
				$Title
			<% end_control %>
  		</h3>
		  <% if Children %>	    
		    <% if Children %>
		    <ul id="Menu2">
		      <% control Children %>
		      <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a></li>
		      <% if LinkOrSection = section %>
	  				<% if Children %>
						<ul class="sub">
							<li>
				 				<ul>
								 	<span class="roundWhite">
								  	<% control Children %>
						  	  			<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levelb"><span><em>$MenuTitle</em></span></a></li>
 				 					<% end_control %>
 				 					</span>
			 				 	</ul>
			 				 </li>
					  	</ul>
			 		 <% end_if %>
				<% end_if %> 
			  <% end_control %>
		      <li></li>
		    </ul>
		    <% end_if %>
		  <% end_if %>
	  <% end_control %>
	</div>
</div>

Avatar
Phalkunz

Community Member, 69 Posts

29 September 2008 at 11:09am

It should be like the following.

<% control Menu(1) %>
	$Title<br/>
	
	<% control Children %>
	
		--- $Title <br/>
		
		<% control Children %>
			------ $Title <br/>
		<% end_control %>
		
	<% end_control %>
	
<% end_control %>