On 4/19/06, Tres Seaver <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > gf wrote: > > On 4/19/06, Andreas Jung <[EMAIL PROTECTED]> wrote: > > > >> > >>--On 19. April 2006 08:39:37 -0600 gf <[EMAIL PROTECTED]> wrote: > >> > >> > >>> {url2,summary2,alias2}, ...] > >>> > >>>I would like to create something like the following: > >>><dl> > >>><dt><a href="url1">alias1</a></dt> > >>><dd>summary1</dd> > >>><dt><a href="url2">alias2</a></dt> > >>><dd>summary2</dd> > >>>... > >>></dl> > >>> > >>>Below I have listed a couple of the variations of code that I have tried. > >>> > >>>I'd appreciate any help or advice you can give. > >>> > >>>Regards, > >>>gyro > >>> > >>>=== > >>> > >>>The following creates repeated definition lists: > >>> > >>>--- > >>> > >>><dl tal:define="folder_info get_subfolder_info" > >>>tal:repeat="finfo folder_info"> > >>><dt><a tal:attributes="href finfo/url" > >>> tal:content="finfo/alias">the term</a></dt> > >>><dd tal:content="finfo/summary">the definition</dd> > >>></dl> > >>> > >>Move the ral:repeat *inside* the DT tag. > >> > >> > >>>--- > >>> > >>>If I include a 'span' to repeat only the dt and dd tagged elements, > >>>the list is not formatted properly (the 'span' messes up the 'dd' > >>>formatting). > >> > >>In this case tal:omit-tag is your friend...as documented. > > Another common practice is to introduce an element in the 'tal' > namespace to group the repeated elements; such tags are automatically > omitted when rendered. E.g.: > > <dl> > <tal:loop tal:repeat="finfo folder_info"> > <dt><a tal:attributes="href finfo/url" > tal:content="finfo/alias">THE_TERM</a></dt> > <dd tal:content="finfo/summary"THE_DEFINITION</dd> > </tal:loop> > </dl> > > This technique has the advantage of not confusing tools which think they > know what the correct content model for '<span>' is (of course, they > need to be willing to ignore elements from unknown namespaces). > > > Tres. > - -- >
Hi Tres, Thanks for the great idea! I'm a zpt and zope newbie, so please forgive my ignorance. Does what you recommended mean that if I have no need for a 'real' tag, I can create and use a 'tal'-based tag like you did in your example? Does the element 'loop' have any special meaning? It seems as if using 'div's and 'span's just to hold tal directives is not a great idea (even if they can be 'omit-tag'ged away), or am I missing something? Although I am reading as much as I can about zpt, I seem to be missing a lot of important stuff. Cheers, gyro _______________________________________________ ZPT mailing list ZPT@zope.org http://mail.zope.org/mailman/listinfo/zpt