ZPT ==> DTML conversion impossible?
Hi, I was get following code sample from examples (Root Folder/Examples/Navigation). It is working standalone, but I need no <ul><li> tags, only simple <br> between listed items instead. <div tal:define="siblings here/siblings.py"> <ul tal:condition="siblings"> <li tal:repeat="folder siblings"> <a href="folder" tal:attributes="href folder/absolute_url" tal:content="folder/getId">folder id</a> </li> </ul> <p tal:condition="not:siblings"><b>There are no sibling folders here.</b></p> </div> I have no idea to get out <li><ul> tags from ZPT as shown here (except generating <TR><TD> instead), so I decide to convert this piece of code to DTML, which is much pretty. But I dont know ZPT and my conversion tryouts are out :( Many thanks, Jaroslav Lukesh
Hi Jaroslav Here's the page template snippet with <br> tags instead of <ul> and <li>: <div tal:define="siblings here/siblings.py"> <div tal:condition="siblings" tal:repeat="folder siblings" tal:omit-tag=""> <a href="folder" tal:attributes="href folder/absolute_url" tal:content="folder/getId">folder id</a> <br> </div> <p tal:condition="not:siblings"><b>There are no sibling folders here.</b></p> </div> Everything you want to repeat is inside the inner <div> tag, but by adding the tal:omit-tag attribute, you tell it not to output the <div>, only its contents. Hope that makes sense. If you still want to do it in dtml, the following will work: <dtml-var standard_html_header> <dtml-in siblings.py> <a href="<dtml-var absolute_url>"><dtml-var title_or_id></a> <br> </dtml-in> <dtml-var standard_html_footer> Yes, it is shorter, but I think using page templates is more elegant and is well worth learning. Felix. On Mon, Jul 08, 2002 at 06:05:23PM +0200, Jaroslav Lukesh wrote:
Hi,
I was get following code sample from examples (Root Folder/Examples/Navigation). It is working standalone, but I need no <ul><li> tags, only simple <br> between listed items instead.
participants (2)
-
Felix Ulrich-Oltean -
Jaroslav Lukesh