You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Holloway <bi...@gmail.com> on 2008/03/07 00:43:17 UTC
Comma-delimited looper
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by Bill Holloway <bi...@gmail.com>.
Right, I can do
<t:loop...>
<t:if ...> ,</t:if><t:body />
</t:loop>
bill
On Fri, Mar 7, 2008 at 7:38 PM, Filip S. Adamsen <fs...@fsadev.com> wrote:
> 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 <fs...@fsadev.com> 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: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
"The modern conservative is engaged in one of man's oldest exercises
in moral philosophy; that is, the search for a superior moral
justification for selfishness."
-- John Kenneth Galbraith
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
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 <fs...@fsadev.com> 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: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by Bill Holloway <bi...@gmail.com>.
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 <fs...@fsadev.com> 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: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
"The modern conservative is engaged in one of man's oldest exercises
in moral philosophy; that is, the search for a superior moral
justification for selfishness."
-- John Kenneth Galbraith
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Well, I learnt that trick from looking at your source code. ;)
-Filip
Howard Lewis Ship skrev:
> Clever!
>
> On Fri, Mar 7, 2008 at 7:24 AM, Filip S. Adamsen <fs...@fsadev.com> 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: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by Howard Lewis Ship <hl...@gmail.com>.
Clever!
On Fri, Mar 7, 2008 at 7:24 AM, Filip S. Adamsen <fs...@fsadev.com> 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: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Comma-delimited looper
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org