[Helma-user] Small patch for loop macro
Hannes Wallnoefer
hannes at helma.at
Thu May 10 13:39:05 CEST 2007
Hi Maks,
2007/5/10, Maksim Lin <maksim.lin at gmail.com>:
> Hi Hannes,
>
> Thanks for looking at the patch so quickly. Your change looks ok but
> the reason I did it with a buffer was because of the bug I entered a
> little earlier about all the macros in HopObject.js
> (http://helma.org/bugs/show_bug.cgi?id=519)
I see.
Actually, using res.write() is fully compatible with
renderSkinAsString(). When you do a renderSkinAsString(), Helma calls
res.push() before rendering the skin and then returns the return value
of res.pop(). Every res.write() or res.writeln() called during skin
rendering actually appends to the StringBuffer that composes the
string.
So bug 519 is actually based on a misunderstanding, I'm marking it as invalid.
hannes
> What worries me is that its not possible to use any of these macros
> with RenderSkinAsString() to for instance create the body of an email
> message.
> I understand now that the reason for using res.write is for efficiency
> but it does mean that the macros aren't as widely usable...
>
> Maks.
>
> On 5/10/07, Hannes Wallnoefer <hannes at helma.at> wrote:
> > Hi Maks,
> >
> > thanks for the patch. The itemPrefix/Suffix parameters make sense, but
> > by composing a new string for each item instead of just using
> > res.write() you add a lot of overhead. I slightly modified your patch,
> > see attachment. Can you (or somebody else) please give it a try?
> >
> > hannes
> >
> > 2007/5/10, Maksim Lin for technical support mailling lists
> > <maksim_lin at ngv.vic.gov.au>:
> > > Hi,
> > >
> > > Ever since I discovered the loop macro (via the new reference docs) I've
> > > found it *very* handy but one thing I missed was the ability to set a
> > > prefix/suffix on each individual items skin render. So I've attached a
> > > small patch to add this functionality to HopObject loop macro.
> > >
> > > I find it very handy since sometimes I'm rendering items of a collection
> > > as HTML list items, sometimes as options in a select element, sometimes
> > > as just a comma seperated list and this way I can do it all with one
> > > very simple skin.
> > >
> > > Maks.
> > >
> > > _______________________________________________
> > > Helma-user mailing list
> > > Helma-user at helma.org
> > > http://helma.org/mailman/listinfo/helma-user
> > >
> > >
> > >
> >
> > _______________________________________________
> > Helma-user mailing list
> > Helma-user at helma.org
> > http://helma.org/mailman/listinfo/helma-user
> >
> >
> >
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
>
More information about the Helma-user
mailing list