Re: Small patch for loop macro

"Maksim Lin for technical support mailling lists" <[email protected]>
Newsgroups gmane.comp.java.helma.general
Message-ID <[email protected]>
Ah that makes much more sense - thanks for explaining that Hannes, yes I
did misunderstand how RenderSkinAsString worked - I should probaly have
read the source before making an assumption about how it worked.

I guess that means in macros, its more efficient to write their result
string in with res.write or writeln instead of returning the string from
the macro function?

Maks.

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Hannes Wallnoefer
> Sent: Thursday, 10 May 2007 21:39
> To: Helma User Mailing List
> Subject: Re: [Helma-user] Small patch for loop macro
> 
> Hi Maks,
> 
> 2007/5/10, Maksim Lin <[email protected]>:
> > 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 <[email protected]> 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
> > > <[email protected]>:
> > > > 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
> > > > [email protected]
> > > > http://helma.org/mailman/listinfo/helma-user
> > > >
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Helma-user mailing list
> > > [email protected]
> > > http://helma.org/mailman/listinfo/helma-user
> > >
> > >
> > >
> > _______________________________________________
> > Helma-user mailing list
> > [email protected]
> > http://helma.org/mailman/listinfo/helma-user
> >
> _______________________________________________
> Helma-user mailing list
> [email protected]
> http://helma.org/mailman/listinfo/helma-user
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.