Get page children of a certain page in menu

30 views
Skip to first unread message

Heiko

unread,
Apr 21, 2012, 6:32:20 PM4/21/12
to Zotonic developers
Hi there,

i think zotonic needs a way to get children of a certain page, so i
made one:

http://93-interactive.com/cms/home/zotonic-page-children/

Usage: {% with pageid|menu_children as children %}...

Simple example navigation included.

Feel free to include it in the main distribution

Arjan Scherpenisse

unread,
Apr 23, 2012, 3:25:45 AM4/23/12
to zotonic-d...@googlegroups.com
Hi Heiko,

Nice filter :)

Coincidentally, Marc committed a similar filter a few days ago as well,
called menu_subtree. That one not only gets the direct children, but
everything under a certain page.

I'll check the difference between the two and see if yours can be included.

cheers,
Arjan

Marc Worrell

unread,
Apr 23, 2012, 3:41:11 AM4/23/12
to zotonic-d...@googlegroups.com
Hi Heiko and Arjan,

Yes, that is a very big coincidence!
Apparently we both have a need for the submenu at the same time!

Difference is that my filter works on the "menu" property (and not the direct id) and returns the sub-menu.

The idea of my filter was to get the sub-menu for navigation on simple devices that can't display the complete menu.

It is only committed to the 0.9dev master and is called "menu_subtree":

> menu_subtree:
> Finds the menu below a particular resource id.
> Usage: m.rsc.main_menu.menu|menu_subtree:id

Best,

Marc

Michael Connors

unread,
Apr 23, 2012, 5:38:14 AM4/23/12
to zotonic-d...@googlegroups.com
Thanks, very useful.
Is there also a filter to find if where in the tree a page is, so that
you know which item to set current on the parent menu, and which
sub-menu to show?

Marc Worrell

unread,
Apr 23, 2012, 5:47:40 AM4/23/12
to zotonic-d...@googlegroups.com
That is a good idea.

We have two options for that:

1. Return the path together with the submenu
2. Make a separate filter to find the path

What would be best? (obviously #1 is less work for the server)

- Marc

Arjan Scherpenisse

unread,
Apr 23, 2012, 5:50:55 AM4/23/12
to zotonic-d...@googlegroups.com
Yes, that one is called menu_trail, I believe.

Marc Worrell

unread,
Apr 23, 2012, 5:52:58 AM4/23/12
to zotonic-d...@googlegroups.com
:-) nothing to add then!

- Marc

Michael Connors

unread,
Apr 23, 2012, 6:02:59 AM4/23/12
to zotonic-d...@googlegroups.com
On 23 April 2012 11:50, Arjan Scherpenisse <ar...@scherpenisse.net> wrote:
> Yes, that one is called menu_trail, I believe.
>

Is it possible to have the menu scomp mark a menu item as current
while in a sub-menu page?

Marc Worrell

unread,
Apr 23, 2012, 6:18:01 AM4/23/12
to zotonic-d...@googlegroups.com
Just checked the '_menu.tpl' and it does.
(this is the 0.9dev source with the bootstrap menu)

It sets the the class to 'current' on the menu items that are in the trail.

- Marc

Reply all
Reply to author
Forward
0 new messages