[Zope] Re: [Zope-dev] Reading contents of a Page Template

Anitha George anithageorge27 at hotmail.com
Wed Aug 20 06:53:03 EDT 2003


Thank You Mr.Cameroon
I tried item/recurse and it works
I need to try a few more things
Especially with respect to showing the anchor Tags after parsing through the 
files.
I just wanted to stress the importance of getting the anchor tags to appear 
in my sitemap as well.
I apologize if writing everything in CAPS  seemed to imply something else.
I am just a beginner at this and hence the mistake.
Thanks for pointing this out .I will avoid this in all future mails.
Thanks once again
Anitha


>From: J Cameron Cooper <jccooper at jcameroncooper.com>
>To: Anitha George <anithageorge27 at hotmail.com>,  zope-dev at zope.org
>Subject: Re: [Zope-dev] Reading contents of a Page Template
>Date: Mon, 18 Aug 2003 15:05:44 -0500
>
>>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 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.
>
>Basic CS. Q: How do you walk a tree? A: Recursion.
>
>Try this Page Template. Name it 'recurse'::
><ul>
><li tal:repeat="item here/objectValues">
>   <span tal:content="item/getId" tal:omit-tag="">An object</span> :
>   <span tal:content="item/title" tal:omit-tag="">A title</span>
>   <span tal:condition="python:item.meta_type=='Folder'" 
>tal:content="structure item/recurse">A Folder listing</span>
></li>
></ul>
>
>The condition check is pretty primitive. Probably a better one would check 
>for the presence of the objectValues method like
>
>tal:define="folderish nocall:item/objectValues"
>tal:condition="folderish | nothing"
>
>This will construct a nested HTML unordered list of your tree from the 
>place where you called it (from inside a valid HTML page.) You can of 
>course tweak the display code.
>
>There are also products that will create site maps. Search around.
>
>>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?
>>IS THERE SOME OTHER WAY TO DO ALL THESE ???
>
>You know that all-caps is considered yelling rather than empahsis, right? 
>Generally not a good idea when asking for help.
>
>Anyway, this is harder. You would have to render and then parse the HTML to 
>get the tags. You could have a script that does that on leaves, or create 
>(either offline or dynamically) children (by inheriting ObjectManager in a 
>custom class) or a list property of the object representing the available 
>anchor tags. You could also do this by hand. Maybe you could replace your 
>documents with folders containing the various anchors as separate segments 
>composited in the index_html. The segments could be easily found that way, 
>although you'd have to make your tree-walker recognize them as leaves 
>instead of containers.
>
>          --jcc
>
>--
>"My point and period will be throughly wrought,
>Or well or ill, as this day's battle's fought."
>
>

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail




More information about the Zope mailing list