velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Glass-Husain <wgl...@forio.com>
Subject Re: Foreach syntax and whitespace
Date Sun, 07 Jul 2002 03:14:50 GMT

Hi Dave,

A tip that I've found works with my editor (Dreamweaver) is to insert VTL 
within a HTML comment whenever I can.  Often the so called comment is preserved 
with no changes to spaces or returns.


<!--  #foreach($email in $email_list)  -->
 <p>$email</p>
<!--  #end  -->

Of course, this outputs as the following, which displays fine in the browser.

<!--    -->
 <p>email1</p>
 <p>email2</p>
 <p>email3</p> (etc)
<!--   -->

WILL

Quoting Dave Dutcher <djdutcher74@earthlink.net>:

> Hello,
> 
> I'm using Velocity to generate some html, and I have a script like
> this:
> 
> #foreach($email in$email_list)
> <p>$email</p>
> #end
> 
> And it works great, but I am trying to enter the VTL directly into a
> WYSIWYG
> html editor.  Maybe I will have to edit the html file once the editor
> is
> done with it, but I'd like to avoid that so I don't have to re-edit the
> html
> file everytime I change something with the editor.  Sometimes though
> the
> editor will end up splitting the foreach line like this:
> 
> #foreach($email
> in$email_list)
> <p>$email</p>
> #end
> 
> Then when I try to merge the html file with a VelocityContext I get an
> exception.
> 
> I tried doing this:
> #foreach($(email)in$email_list)
> 
> but that didn't work either.  It seems that Velocity needs a space, (not
> a
> CR/LF) between $email and in and nothing else will work.  Is that true,
> or
> is there something I'm missing?
> 
> Thanks,
> 
> Dave
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
> 
> 



------------------------------------
Will Glass-Husain  <wglass@forio.com>
Forio Business Simulations
office: (415) 440-7500
mobile: (415) 235-4293

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message