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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

How to make top menu sections without content and jump to the first child?


Go to End


10 Posts   4188 Views

Avatar
Liam

Community Member, 470 Posts

3 September 2008 at 5:29am

I'd like the same type of thing, except I don't need a link outputted from a certain parent page. I need just a blank <a> tag produced from a page in the sitetree, no redirects.

The reason being I am building a suckerfish navigation menu so I still need the <a> tag produced for the parent, so when a user hovers over it, the suckerfish menu is displayed listing the child pages.

Is this at all possible?

Avatar
Sean

Forum Moderator, 922 Posts

3 September 2008 at 7:28pm

Edited: 03/09/2008 7:29pm

Hmm, one way I think you could achieve this would be to override the Link() method on your page-type. This means that for that particular $Link in the template loop for the menu there's nothing returned, thus you can do <% if Link %><a href="$Link">$MenuTitle</a><% else %><span>$MenuTitle</span><% end_if %> - or something similar.

Example:


<?php

class UnlinkedPage extends Page {

	function Link() {
		return false;
	}

}

class UnlinkedPage_Controller extends Page_Controller {

}

?>

It's kind of a theory more than anything. I'm not sure if there'll be any side effects from a page not having a valid Link() method, but it's certainly worth a try I believe.

Sean

Go to Top