jvanzyl     00/10/20 23:23:20

  Modified:    xdocs    vtl-reference-guide.xml
  Log:
  - #foreach docs.
  
  Revision  Changes    Path
  1.8       +58 -0     jakarta-velocity/xdocs/vtl-reference-guide.xml
  
  Index: vtl-reference-guide.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/vtl-reference-guide.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- vtl-reference-guide.xml   2000/10/21 06:11:20     1.7
  +++ vtl-reference-guide.xml   2000/10/21 06:23:19     1.8
  @@ -272,6 +272,64 @@
   <p>        
       <strong>#foreach</strong>
       <br/>
  +    The #foreach directive provide a simple way of looping
  +    through a list of objects:
  +</p>
  +
  +<p>
  +    <source><![CDATA[
  +    <table>
  +    #foreach ($customer in $customerList)
  +        <tr>
  +          <td>
  +            $customer.Name
  +          </td>
  +        </tr>
  +    #end        
  +    ]]></source>
  +</p>
  +
  +<p>
  +    Velocity provides an easy way to get the loop
  +    counter so that you can do something like the
  +    following:
  +</p>
  +    
  +<p>    
  +    <source><![CDATA[
  +    <table>
  +    #foreach ($customer in $customerList)
  +        <tr>
  +          <td>
  +            $velocityCounter
  +          </td>
  +          <td>
  +            $customer.Name
  +          </td>
  +        </tr>
  +    #end        
  +    ]]></source>
  +</p>
  +
  +<p>
  +    The default name for the loop counter variable
  +    reference is $velocityCounter, but you can specify
  +    this in the velocity.properties file. You can also
  +    specify whether the counter should start at 0 or 1.
  +    Here's what the properties look like in the
  +    velocity.properties file:
  +</p>    
  +
  +<p>    
  +    <source><![CDATA[
  +    # Default name of the loop counter
  +    # variable refernce.
  +    counter.name = velocityCount
  +    
  +    # Default starting value of the loop
  +    # counter variable reference.
  +    counter.initial.value = 1
  +    ]]></source>
   </p>
   
   <p>        
  
  
  

Reply via email to