Dylan Reinhardt wrote:
<div metal:use-macro="container/lay_box/macros/box"> <span metal:fill-slot="title">UV elementer</span> <div metal:fill-slot="content"> This is some content ... that can be very flexible ... </div> </div>
How is the above possibly simpler or easier to read than: <dtml-var "lay_box(boxTitle='Some title', boxContent='This is some content ...')">
You are right that zpt looks worse on the surface, but if you want "boxContent" to be something like: <table> <dtml-in "objectValues()"> <tr> <td>• <a href="<dtml-var absolute_url>"><dtml-var title_or_id></a></td> </tr> </dtml-in> </table> You would need to create another dtml document just for the purpose of writing the content of this "box" If you have 5 boxes on a page, that is a LOT of auxillary methods just for rendering one view. It is code bloat that makes the code much harder to follow. I know ... i've been there. In zpt, on the other hand, you have it all in one easy to read file. ------------------ <div metal:use-macro="container/lay_box/macros/box"> <span metal:fill-slot="title">Some title</span> <div metal:fill-slot="content"> <table> <tr tal:repeat="obj here/objectValues"> <td>• <a hef="#" tal:attributes="href obj/absolute_url" tal:content="obj/title_or_id">">title</a></td> </tr> </table> </div> </div> <div metal:use-macro="container/lay_box/macros/box"> <span metal:fill-slot="title">Some other title</span> <div metal:fill-slot="content"> This is my second box with unique content, and still just 1 file. </div> </div> ------------------ The advantage being that you can have all the code concerning 1 view/page in the same file, while you still only have to write the code that is unique to that particular view. And you can re-use design elements at the same time.
Your example shows not just the same results, but the same logic and same shortcomings. It's just different syntax layered on the same basic solution. Each example is created and declared differently, but they model the exact same process.
Naturally. But how they do it makes a hell of a difference in practice.
Making anything more complex than your example is going to increase the complexity of the code in ZPT too, which is the only argument you raised against doing it in DTML.
No. You will need a lot more glue code in dtml to do the same thing as you do "naturally" in zpt. regards Max M