Jump to:

23374 Posts in 18175 Topics by 2866 members

General Questions

SilverStripe Forums » General Questions » Custom entries in a menu

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 633 Views
  • Chris J
    Avatar
    Community Member
    10 Posts

    Custom entries in a menu Link to this post

    I have a drop down menu which I want to add extra pages to. These pages are already in the menu but need to be in there more than once.

    Below is an example of my dropdown menu with a manual addition of a link. (The if ID = 6 condition)

    <ul id="drop_down">
       <% control Menu(1) %>
          <% if Children %>
             <li><a href="$Link" title="View more info about $Title"><span>$MenuTitle</span></a>
                <ul>
                   <% control Children %>
                      <li><a href="$Link" title="View more about $Title">$MenuTitle</a></li>
                   <% end_control %>
                   
                   <% if ID = 6 %>
                      <li><a href="trips-and-tours-by-type/trip-dates/" title="View more about trip dates">Trip Dates</a></li>
                   <% end_if %>
                   
                </ul>
             </li>
          <% else %>   
             <li><a href="$Link" title="View more info about $Title">$MenuTitle</a></li>
          <% end_if %>
       <% end_control %>
    </ul>

    This works but I want to know if I can rewrite this in a way that I can access

    $Link

    and

    $Title

    etc... for the additional page?

    Cheers

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Custom entries in a menu Link to this post

    You could try and use a virtual page in your sitetree, pointing to the page you want to display. Maybe that will work for you - though I believe there are some issues regarding the display of DataObjects on virtual pages...

  • Chris J
    Avatar
    Community Member
    10 Posts

    Re: Custom entries in a menu Link to this post

    Yea Virtual pages are not really what I need. I have stuck with hard coding in the HTML for now. If anyone else has any ideas I would appreciate that. Cheers

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