And? Whatever content you put after the <t:if/> will still be rendered - and properly comma-delimited. :)

-Filip

Bill Holloway skrev:
Well, sometimes this will be page links, sometimes literal text,
sometimes other components.  The loop body might contain anything.

Bill

On Fri, Mar 7, 2008 at 8:24 AM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
Hi Bill,

 Try this:

   <t:loop source="things" value="currThing" index="var:index">
     <t:if test="var:index">, </t:if>

     <t:pagelink page="Details"
 context="currThing.id">${currThing.name}</t:pagelink>
   </t:loop>

 On the first iteration of the loop index will be 0 which evaluates to
 false. Any other iteration will output the comma.

 -Filip

 Bill Holloway skrev:


I need to comma-delimit components in a loop that will be <t:pagelinks>.  I.e.,
 >
 > <t:loop source="things" value="currThing">
 >     <t:pagelink page="Details"
 > context="currThing.id">${currThing.name}</t:pagelink>,
 > </t:loop>
 >
 > The above, of course, produces a trailing comma.
 >
 > I know that some CSS tricks can turn a <ul> into a comma-delimited
 > list, but the only CSS solutions I've seen use things like ul
 > li::before and other CSS things that don't play well with @#$%#$@
 > internet exploiter.
 >
 > If the _source or even _iterator instance variables of the Loop class
 > were protected rather than private, I could just subclass Loop and
 > override the afterRenderBody, check _iterator.hasNext and emit ", " if
 > there is a next.
 >
 > Any thoughts?
 >
 > Bill
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]
 >
 >

 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to