You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/08/15 21:32:50 UTC

svn commit: r686342 - in /velocity/engine/trunk/xdocs/docs: developer-guide.xml user-guide.xml

Author: nbubna
Date: Fri Aug 15 12:32:50 2008
New Revision: 686342

URL: http://svn.apache.org/viewvc?rev=686342&view=rev
Log:
VELOCITY-600 document $velocityHasNext

Modified:
    velocity/engine/trunk/xdocs/docs/developer-guide.xml
    velocity/engine/trunk/xdocs/docs/user-guide.xml

Modified: velocity/engine/trunk/xdocs/docs/developer-guide.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=686342&r1=686341&r2=686342&view=diff
==============================================================================
--- velocity/engine/trunk/xdocs/docs/developer-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/developer-guide.xml Fri Aug 15 12:32:50 2008
@@ -1607,6 +1607,13 @@
 </p>
 
 <p>
+<code>directive.foreach.iterator.name = velocityHasNext</code><br/>
+Used in the #foreach() directive, defines the string to be used as the
+context key for the "has next" value. A template would access
+this as $velocityHasNext.
+</p>
+
+<p>
 <code>directive.foreach.counter.initial.value = 1</code><br/>
 Default starting value for the loop counter reference in a #foreach() loop.
 </p>

Modified: velocity/engine/trunk/xdocs/docs/user-guide.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/xdocs/docs/user-guide.xml?rev=686342&r1=686341&r2=686342&view=diff
==============================================================================
--- velocity/engine/trunk/xdocs/docs/user-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/user-guide.xml Fri Aug 15 12:32:50 2008
@@ -1379,6 +1379,19 @@
 ]]></source>
 
     <p>
+    Velocity also now provides an easy way to tell if you are
+    on the last iteration of a loop:
+    </p>
+
+<source><![CDATA[
+#foreach( $customer in $customerList )
+    $customer.Name#if( $velocityHasNext ),#end
+#end
+]]></source>
+
+    <p>
+    The default name for the "has next" variable reference, which is
+    specified in the velocity.properties file, is $velocityHasNext. 
     The default name for the loop counter variable reference, which is
     specified in the velocity.properties file, is $velocityCount. By
     default the counter starts at 1, but this can be set to either 0 or
@@ -1391,6 +1404,7 @@
 # Default name of the loop counter
 # variable reference.
 directive.foreach.counter.name = velocityCount
+directive.foreach.iterator.name = velocityHasNext
 
 # Default starting value of the loop
 # counter variable reference.