[Zope3-Users] Re: menus, menu items and actions

Jan-Wijbrand Kolman jw at infrae.com
Thu Jun 2 02:03:36 EDT 2005


Hi Philipp,


Thanks for your suggestions!

Philipp von Weitershausen wrote:
> You don't really need to treat the action path in the menu class. You
> can just as well assemble it in the Page Template where you're actually
> looping over the menu items.

Right. That's what I did initially, but I realised that I had to 'know' about
this base URL in the page template, and possibly in other places too.

<pondering>Then again, if I make a macro out of this specific menu, I only have
to 'know' the base URL in one place and I can leave out the custom Menu
implementation.</pondering>

> If you need a more complex setup, e.g. have your 'stem_url' always be
> the URL of some object that is not the root of your Virtual Host, you
> could define a browser view (not a page!) named 'get_application_root'
> or so, have that traverse the acquisition path to the object and return
> it and then use that object's @@absolute_url.

and

> Hard coding a URL in Python is definitely not very useful.

Sure. I 'hardcoded' the path in the example to simplify it. We do indeed have a
facility in the application to get to the application root.

I think I'll indeed follow you suggestion by creating a macro for the menu and
not use the custom menu implementation. Thanks again!


regards,
jw

-- 
Jan-Wijbrand Kolman
jw at infrae.com


More information about the Zope3-users mailing list