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, biapar, Willr, Ingo, swaiba, simon_w

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


3 Posts   1329 Views

Mat Weir

14 October 2009 at 10:46am (Last edited: 14 October 2009 10:47am), Community Member, 33 Posts

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

15 October 2009 at 10:34am Community Member, 33 Posts

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


26 March 2010 at 10:58pm Community Member, 4 Posts

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?