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.

General Questions /

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

Custom entries in a menu


Reply


3 Posts   680 Views

Avatar
Chris J

Community Member, 10 Posts

18 January 2011 at 1:35pm

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

Avatar
martimiz

Forum Moderator, 1107 Posts

18 January 2011 at 11:42pm

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

Avatar
Chris J

Community Member, 10 Posts

25 January 2011 at 1:33pm

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