mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-04 06:11:37 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			123 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="iso-8859-1"?>
 | 
						|
<!-- $Revision$ -->
 | 
						|
<sect1 id="language.function.counter">
 | 
						|
 <title>counter</title>
 | 
						|
 <informaltable frame="all">
 | 
						|
  <tgroup cols="5">
 | 
						|
   <colspec colname="param" align="center" />
 | 
						|
   <colspec colname="type" align="center" />
 | 
						|
   <colspec colname="required" align="center" />
 | 
						|
   <colspec colname="default" align="center" />
 | 
						|
   <colspec colname="desc" />
 | 
						|
   <thead>
 | 
						|
    <row>
 | 
						|
     <entry>Attribute Name</entry>
 | 
						|
     <entry>Type</entry>
 | 
						|
     <entry>Required</entry>
 | 
						|
     <entry>Default</entry>
 | 
						|
     <entry>Description</entry>
 | 
						|
    </row>
 | 
						|
   </thead>
 | 
						|
   <tbody>
 | 
						|
    <row>
 | 
						|
     <entry>name</entry>
 | 
						|
     <entry>string</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>default</emphasis></entry>
 | 
						|
     <entry>The name of the counter</entry>
 | 
						|
    </row>
 | 
						|
    <row>
 | 
						|
     <entry>start</entry>
 | 
						|
     <entry>number</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>1</emphasis></entry>
 | 
						|
     <entry>The initial number to start counting from</entry>
 | 
						|
    </row>
 | 
						|
    <row>
 | 
						|
     <entry>skip</entry>
 | 
						|
     <entry>number</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>1</emphasis></entry>
 | 
						|
     <entry>The interval to count by</entry>
 | 
						|
    </row>
 | 
						|
    <row>
 | 
						|
     <entry>direction</entry>
 | 
						|
     <entry>string</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>up</emphasis></entry>
 | 
						|
     <entry>the direction to count (up/down)</entry>
 | 
						|
    </row>
 | 
						|
    <row>
 | 
						|
     <entry>print</entry>
 | 
						|
     <entry>boolean</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>true</emphasis></entry>
 | 
						|
     <entry>Whether or not to print the value</entry>
 | 
						|
    </row>
 | 
						|
    <row>
 | 
						|
     <entry>assign</entry>
 | 
						|
     <entry>string</entry>
 | 
						|
     <entry>No</entry>
 | 
						|
     <entry><emphasis>n/a</emphasis></entry>
 | 
						|
     <entry>the template variable the output will be assigned to</entry>
 | 
						|
    </row>
 | 
						|
   </tbody>
 | 
						|
  </tgroup>
 | 
						|
 </informaltable>
 | 
						|
 <para>
 | 
						|
  counter is used to print out a count. counter will remember the
 | 
						|
  count on each iteration. You can adjust the number, the interval
 | 
						|
  and the direction of the count, as well as determine whether or not
 | 
						|
  to print the value. You can run multiple counters concurrently by
 | 
						|
  supplying a unique name for each one. If you do not supply a name,
 | 
						|
  the name 'default' will be used.
 | 
						|
 </para>
 | 
						|
 <para>
 | 
						|
  If you supply the special "assign" attribute, the output of the
 | 
						|
  counter function will be assigned to this template variable instead of
 | 
						|
  being output to the template.
 | 
						|
 </para>
 | 
						|
 <example>
 | 
						|
  <title>counter</title>
 | 
						|
  <programlisting>
 | 
						|
<![CDATA[
 | 
						|
{* initialize the count *}
 | 
						|
{counter start=0 skip=2}<br />
 | 
						|
{counter}<br />
 | 
						|
{counter}<br />
 | 
						|
{counter}<br />
 | 
						|
]]>
 | 
						|
  </programlisting>
 | 
						|
  <para>
 | 
						|
   this will output:
 | 
						|
  </para>
 | 
						|
  <screen>
 | 
						|
<![CDATA[
 | 
						|
0<br />
 | 
						|
2<br />
 | 
						|
4<br />
 | 
						|
6<br />
 | 
						|
]]>
 | 
						|
  </screen>
 | 
						|
 </example>
 | 
						|
</sect1>
 | 
						|
<!-- Keep this comment at the end of the file
 | 
						|
Local variables:
 | 
						|
mode: sgml
 | 
						|
sgml-omittag:t
 | 
						|
sgml-shorttag:t
 | 
						|
sgml-minimize-attributes:nil
 | 
						|
sgml-always-quote-attributes:t
 | 
						|
sgml-indent-step:1
 | 
						|
sgml-indent-data:t
 | 
						|
indent-tabs-mode:nil
 | 
						|
sgml-parent-document:nil
 | 
						|
sgml-default-dtd-file:"../../../../manual.ced"
 | 
						|
sgml-exposed-tags:nil
 | 
						|
sgml-local-catalogs:nil
 | 
						|
sgml-local-ecat-files:nil
 | 
						|
End:
 | 
						|
vim600: syn=xml fen fdm=syntax fdl=2 si
 | 
						|
vim: et tw=78 syn=sgml
 | 
						|
vi: ts=1 sw=1
 | 
						|
--> |