You are not logged in Log in Join
You are here: Home » Members » Greg's Zope Software » How to create tabs for user pages

Log in
Name

Password

 

How to create tabs for user pages

This folder contains a dtml method MakeTabs and that can be used to create your own tabs that are exactly like those on the Zope management pages. The Python Script FileListTabs shows how to use MakeTabs to create one tab for each element of the current folder using the object description as the tab label. Clicking on the tab will jump to the corresponding object.

The reason that the tabs are exaclty the same is that I copied the code from $ZOPEDIR/lib/python/App/dtml/manage_tabs.dtml.

A simple example:

<dtml-let tabs="({'label':'MakeTabs (DTML Method)', 'action':'MakeTabs'}, 
                 {'label':'FileListTabs (Python Script)', 'action':'FileListTabs'},)">
   <dtml-var MakeTabs.dtml>
</dtml-let>
</p>

which yields:

  
 MakeTabs (DTML Method)   FileListTabs (Python Script) 

A more advanced example:

<dtml-comment>
	This DTML Method creats tabs for each 'File' object in the 
	current folder.  The object id will be in large red font, 
	followed on the next line by the description.  Each tab
	will link to the corresponding object.	
</dtml-comment>

<dtml-with URL1>
   <dtml-let tabs="[]">
 
   <dtml-in expr="objectValues('File')">
     <dtml-let label="'<font color=#FF0000 size=+1>' + 
                       _.getitem('id',1) + 
                      '</font><br>' + 
                      _.getitem('title',1)">

        <dtml-call "tabs.append({'label':label,
                                 'action':_.getitem('id',1)})">
     </dtml-let>
   </dtml-in>

   <dtml-var MakeTabs.dtml>

   </dtml-let>
</dtml-with>

which yields

(NO TABS DEFINED)

-Greg Warnes