10376 Posts in 2191 Topics by 1708 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1209 Views |
-
GenericViews: $Menu(2) doesn't work in CollectionController.ss

14 October 2009 at 10:46am Last edited: 14 October 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 CollectionController.ss (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?
Cheers
-
Re: GenericViews: $Menu(2) doesn't work in CollectionController.ss

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...
-
Re: GenericViews: $Menu(2) doesn't work in CollectionController.ss

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 svn.silverstripe.com ;)
I think that would work for you too?
| 1209 Views | ||
|
Page:
1
|
Go to Top |


