[Zope3-Users] Zope 3 and menus

eXt news.crumbler at gmail.com
Tue Mar 13 08:24:57 EDT 2007


Hi

	I've got a problem with menus. I'd like to define a global menu, and then add 
some options to it depending on actual context (view registered for specific 
interface). The problem is that when I define global menu element link like: 
action="/index.html" it generates url which omits my folder structure which 
shold be: root/my_site/index.html  and creates: root/index.html. On the other 
side when i use: action="index.html" the url which is created is always 
relative. I'd like to be able to define my_site (which is in fact a Site 
object) to be root for actions.

What is the correct solution for that? Should I edit global urls before 
displaying them (add my_site part)? Look at third code snippet below - it 
generates urls so I can easly change some strings. Is this a proper solution?

My code:

Menu definition:

 <browser:menu
      id="monitor_menu"
      title="menu description here"
  />

Global menu action (snippet from worldcookery.com code):

  <browser:menuItem
      for="*"
      menu="monitor_menu"
      title="Start"
      action="/index.html"
      permission="zope.View"
  />

Context dependent action:

<browser:page
      name="edit.html"
      for="..interfaces.IMonitorConfDB"
      class=".monitor_conf_db_view.MonitorConfDBEditForm"
      permission="zope.View"
      menu="monitor_menu"
      title="Edit config"
      />

I display menu using viewlet with template (iirc code from worldcookery book):

<div id="monitor_menu" class="box">
    <ul>
        <li tal:repeat="item context/@@view_get_menu/monitor_menu">
            <a href=""
                tal:attributes="href item/action; title item/description"
                tal:content="item/title"></a>
        </li>
    </ul>    
</div>


-- 
Jakub Wisniowski


More information about the Zope3-users mailing list