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.

All other Modules /

Discuss all other Modules here.

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

GenericViews: $Menu(2) doesn't work in

Go to End

3 Posts   1549 Views

Mat Weir

Community Member, 33 Posts

14 October 2009 at 10:46am

Edited: 14/10/2009 10:47am

Hey Ingo,

I'm having a play with GenericViews and I really like it.

Having a little trouble with using $Menu(2) in (or any other template) when I'm using it as a page in the site tree. After a bit of debugging I found that the 2 isn't being passed to the Menu method but I'm not sure why.

I'm using trunk version of GenericViews and SS 2.3.3.

Any ideas?


Mat Weir

Community Member, 33 Posts

15 October 2009 at 10:34am

I've narrowed the problem down to here in CollectionController.php:

	public function __get($field) {
		} elseif($this->parentController) {
			return $this->parentController->__get($field);

So it's calling getMenu on the parent controller without passing through any variables from the template.

I can get around it by adding this to CollectionController.php:

	function Menu($level = 1) {
		return $this->parentController->Menu($level);

But I wonder if there's a better solution? Otherwise I'll have to do this for every ContentController method that I want to use in the templates...


Community Member, 4 Posts

26 March 2010 at 10:58pm

I've had similar problems with <% InSection() %> and I've just added the code from the original function which i found via google at ;)

I think that would work for you too?