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.

Archive /

Our old forums are still available as a read-only archive.

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

Separate footer menu


Go to End
Reply


10 Posts   4638 Views

Avatar
NickJacobs

Community Member, 144 Posts

10 October 2008 at 12:25pm

Edited: 10/10/2008 12:58pm

Hi all, I have a top level navigation menu (2 levels) and I also want to have a separate footer menu (2 levels)

my current menu structure looks something like this:

I can get the top level menu working OK by just excluding the footer in the template:

<% control Menu(1) %>
<% if URLSegment != footer %>

<li class="$LinkingMode"><a href="$Link" >$MenuTitle</a>
<% if Children %>
<ul>
<% control Children %>
<li class="$LinkOrSection"><a href="$Link" >$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>

<% end_if %>
<% end_control %>

but I cant work out how to get the footer output...any ideas would be appreciated

Avatar
ajshort

Community Member, 244 Posts

10 October 2008 at 12:58pm

Hey Galilee,

In order to do something like that, you could use this in your template:

<% control ChildrenOf(footer) %>
   Insert your normal navigation code here
<% end_control %>

The ChildrenOf but lets you get the children of any page using the URL segment.

Avatar
NickJacobs

Community Member, 144 Posts

10 October 2008 at 1:00pm

Awesome! works like a charm:)

Avatar
S0crates9

27 Posts

9 November 2008 at 5:33pm

Edited: 09/11/2008 5:35pm

Hi Guys!

Funny thing is that I am still a bit confused about how the navigation is controlled on silverstripe implementations. I've got a similar structure to what was listed on this thread but the advice given didn't work, and I've also tried other methods to get the specific breakout of navigation to work - to no avail.

Take a look at the attached file to see the admin layout. I've set up the navigation to only show top-level items on the homepage and as you go into the second level pages, then opens up the children (third-level) pages.

Now what the pain point seems to be is that I want to put the sitemap page into the footer, not to display it on the nav menu...

Anyone know how I can do this given the page setup I've got?

I would appreciate any info you could afford, been driven a bit nuts trying to get this to work.

Avatar
Liam

Community Member, 470 Posts

10 November 2008 at 8:03am

Edited: 10/11/2008 8:16am

Is the sitemap.xml file your own creation/page? I'm just confused it is showing in the sitetree or am wondering if you did some modification to it.

By default, it is created so you don't have to do anything. domain.com/sitemap.xml Assuming you're not using a really old version of SS.

Anyway, check out this link for another way of making a special menu.

http://doc.silverstripe.com/doku.php?id=recipes:page_selection_for_special_menu

*Edit* Just noticed the reason the other code doesn't work, is that sitemap doesn't have any children so it won't display. What you can do is untick the option to "show in menus" in the behaviour tab on the page type. Then in your footer, do something like

<% control Page(sitemap) %><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a><% end_control %>

Avatar
S0crates9

27 Posts

10 November 2008 at 12:58pm

Edited: 10/11/2008 1:44pm

I am using silverstripe 2.2.3...

Thanks for the response. Sitemap.xml is indeed somethign I added in which generates a standard XML file for SE use.

The code/suggestion you amended seems to also not yield the result I'd imagine...
I still see nothing show up in the footer code.

And as for the thread you referred me to, for some reason I get this error:
"Error The website server has not been able to respond to your request."
And it seems to happen when I put in the topTabbers function into Page.php.

Just to provide a bit more insight into what I have working, here is the nav code:

<ul id="Navigation">
<% control Menu(1) %>
<li>
<a class="$LinkingMode topsec" href="$Link" title="Go to the $Title.XML page">$MenuTitle<span></span></a>
<% if Children %>
<% if LinkOrSection = section %>
<ul id="Sub-Menu">
<% control Children %>
<li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>">
<% if LinkingMode = current %>
<a class="items" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% else %>
<a class="item" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% end_if %>
</li>
<% if LinkOrSection = section %>
<ul id="Sub-Menu">
<% control Children %>
<li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>">
<% if LinkingMode = current %>
<a class="items subsec" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% else %>
<a class="item subsec" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>

<% end_control %>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>

I was thinking that because the files are in a tree format, their hierarchical level would be also used in silverstripe, but I was never able to get beyond menu(1) or Level(1).

#### UPDATE ####
I changed the topTabber function to SiTabber and the error went away, however the pages selected to show up in the special menu still do not appear. I also tried ticking the "show in Menus" checkbox to test the variable, but it still didn't appear in the footer.

Avatar
Liam

Community Member, 470 Posts

10 November 2008 at 6:27pm

Regarding your sitemap.xml, is it any different then the one SS generates? Just wondering if you're making a page that is not needed, as I have mentioned SS generates a sitemapl.xml file for SEO purposes. You don't have to do anything or create your own. If you were to remove/delete/unpublish your page sitemap.xml, you can still access a file domain.com/sitemap.xml which is the default one.

I also noticed my code above is wrong, it should be <% control Page(Site-Map) %>. I read your image wrong. You basically change "Site-Map" to whatever the page name/url is. Lower/Uppercase does matter.

As for the example code for the different menu, not too sure unless I saw some code. I've seen many people use it as is and it works.

Avatar
S0crates9

27 Posts

11 November 2008 at 6:15am

Yes, LeeUmm, the sitemap.xml was one I created since the sitemap.xml that silverstripe was supposed to generate for some reason, did not. And this was across 5 different silverstripe sites I am working with right now.

As for the footer code, I tried changing it and the page still doesn't show up after a flush.

Anything else I can take a look at to figure out what is going wrong?

Thanks again for your assistance!

Go to Top