velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r686342 - in /velocity/engine/trunk/xdocs/docs: developer-guide.xml user-guide.xml
Date Fri, 15 Aug 2008 19:32:50 GMT
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.



Mime
View raw message