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

How to do a "Main Menu" with childrens


Go to End


2 Posts   1300 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 %>