[Zope] Reading contents of a Page Template

Dieter Maurer dieter at handshake.de
Mon Aug 18 21:18:45 EDT 2003


You know that you should not cross post?

Reply restricted to "zope at zope.org" (where your questions belongs to).

Anitha George wrote at 2003-8-17 10:59 +0000:
 > ...
 > I have a requirement to create a SiteMap for my site.
 > My site is dynamically built from the Zope tree structure.
 > Folder and Sub Folders need to appear as a tree structure and need to be 
 > sorted by name and date.
 > I have viewed the examples in the Examples folder in ZMI and gotten a 
 > general Idea of how to get the files within a specific folder.
 > But I need to be able to go through the whole set of folders and sub Folders 
 > and create the SiteMap and not just for a single folder .

Is your requirement similar to the left frame in Zope's Management Interface
(ZMI)?
In this case, you could look at its code (--> "App/dtml/menu.dtml").
"dtml-tree" allows you to preexpand the complete tree.
But, of course, "dtml-tree" generates an interactive tree, which you
may not want.

You can use also the tree support of "ZPT" (which is also usable in DTML).
It provides more control over the tree display than "dtml-tree"
(and therefore you can build a non-interactive tree).
It is defined in the package "ZTUtils".
Look at the ZPT examples to learn how to use it.

 > Is there some While- Do Loop which I can use to Loop through till I reach 
 > the Lowest rung in a Tree for each and every Folder and create a Site Map.

Use a Python Script either to build the complete HTML structure
or to to build an auxiliary structure (e.g. a sequence of (level,obj) pairs)
and format it in ZPT/DTML.

 > Also Each of these folders has an index_html page template which can be 
 > linked from the SiteMap that is created.
 > Each of the index_html files has a number of anchor tags.
 > These Tags are for moving within the Page.
 > I need to be able to include these Tage as well in My SiteMap  ...
 > CAN I GET THESE ANCHOR TAG LINKS ON EACH PAGE BY READING THROUGH THE CONTENT 
 > OF EACH OF THESE PAGE TEMPLATES?

When your tags are "HTML tags", then you would need to parse
their source (and find the tags). This may be a bit expensive.

 > IS THERE SOME OTHER WAY TO DO ALL THESE ???

It would be easier when the tags were generated from an easily accessible
structure (e.g. properties of "index_html" or the folder).



Dieter



More information about the Zope mailing list