velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Getting lines of text individually
Date Wed, 06 Mar 2002 19:40:55 GMT
>Sure
>
>#set($lines= ["Hello","there","Diane"])
>
>#foreach($line in $lines)
>$line
>#end
>
>Will output
>
>Hello
>there
>Diane

Oops -- guess I should have been more clear. What I meant to ask was, is
there any way to have individual lines of input text be dealt with? In
other words, if I have:

<sometag>
Three lines
of text in
an XML file.
</sometag>

and I don't want to have to code a hard linebreak on them, but rather, use
a #foreach to do that for me, is there a way to do that?

Note: I don't know Velocity or Anakia, so I may be asking the question all
wrong, but in looking at the site.vsl file (for the Ant pages), it has a
couple of #foreach loops:

  #foreach ( $items in $section.getChildren() )
and
  #foreach ( $items in $subsection.getChildren() )

that pass $items to the templates.vm file (if that's the right way to put
it), and $items seems to be the entire block of text between the (defined)
<tag></tag>. I'm wondering if there's some way to have it retrieve the
text and deal with it as individual lines first, have it add a <br></br>
to the end of each one, then pass the whole block off.

Thanks!
Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
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