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.

Template Questions /

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

Need help with subnav


Go to End


2 Posts   1665 Views

Avatar
robbied72

Community Member, 1 Post

16 April 2011 at 1:40am

Hi all I want to be able to make the sub nave of the fist tab available on every page without having to replicate pages on every root section.

link - http://bizmohost.com/moish/bw/medical-team/

Your help would be much appreciated

Regards

Robbie

Avatar
JonoM

Community Member, 130 Posts

16 April 2011 at 12:02pm

Edited: 16/04/2011 12:04pm

Hi Robbie,

If you want to send people to the pages in the first section when they click the links you could generate links to the original pages in the templates using similar code to what is producing your subnav on each page, but just change 'Menu(2)' to 'Page(Your-page-URL)'. So for instance:

				<% control Page(Home) %>
				
					<% if Children %>
						<li><a href="$Link" title="Go to the &quot;{$Title.XML}&quot; page" class="$LinkingMode levela parent"><span>$MenuTitle.XML</span></a>
					<% else %>
						<li><a href="$Link" title="Go to the &quot;{$Title.XML}&quot; page" class="$LinkingMode levela"><span>$MenuTitle.XML</span></a>
					<% end_if %>	  
					
						<% if LinkOrSection = section %>
							<% if Children %>
								<ul class="sub">
									<% control Children %>
										<li><a href="$Link" title="Go to the &quot;{$Title.XML}&quot; page" class="$LinkingMode levelb"><span>$MenuTitle.XML</span></a></li>
									<% end_control %>
								</ul>
							<% end_if %>
						<% end_if %>
						
						</li>
				<% end_control %>

http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls?s=page%252520controls

or, you could create virtual pages in each section which point back to the pages in the first tab so that they automatically display whatever is on those pages, meaning you don't have to update multiple identical pages. This will keep the user in the relevant section unlike a Redirector page or the method above which would send them to the page in the first section.