Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » Need help with subnav

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

Page: 1
Go to End
Author Topic: 1015 Views
  • robbied72
    Avatar
    Community Member
    1 Post

    Need help with subnav Link to this post

    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

  • JonoM
    Avatar
    Community Member
    103 Posts

    Re: Need help with subnav Link to this post

    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.

    1015 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.