Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 3ca7e0e5486da714e98ac79af09ca745 > files > 67

php-smarty2-doc-2.6.28-2.mga4.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{counter}</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Smarty Manual">
<link rel="up" href="language.custom.functions.html" title="Chapter 8. Custom Functions">
<link rel="prev" href="language.custom.functions.html" title="Chapter 8. Custom Functions">
<link rel="next" href="language.function.cycle.html" title="{cycle}">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">{counter}</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.custom.functions.html">Prev</a> </td>
<th width="60%" align="center">Chapter 8. Custom Functions</th>
<td width="20%" align="right"> <a accesskey="n" href="language.function.cycle.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="{counter}">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.function.counter"></a>{counter}</h2></div></div></div>
<p>
   <code class="varname">{counter}</code> is used to print out a count.
   <code class="varname">{counter}</code> 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 <span class="quote">“<span class="quote">default</span>”</span> will be used.
  </p>
<p>
   If you supply the <em class="parameter"><code>assign</code></em> attribute, the output of the
   <code class="varname">{counter}</code> function will be assigned to this template
   variable instead of being output to the template.
 </p>
<div class="informaltable"><table border="1">
<colgroup>
<col align="center">
<col align="center">
<col align="center">
<col align="center">
<col>
</colgroup>
<thead><tr>
<th align="center">Attribute Name</th>
<th align="center">Type</th>
<th align="center">Required</th>
<th align="center">Default</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td align="center">name</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em>default</em></span></td>
<td>The name of the counter</td>
</tr>
<tr>
<td align="center">start</td>
<td align="center">number</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em>1</em></span></td>
<td>The initial number to start counting from</td>
</tr>
<tr>
<td align="center">skip</td>
<td align="center">number</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em>1</em></span></td>
<td>The interval to count by</td>
</tr>
<tr>
<td align="center">direction</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em>up</em></span></td>
<td>The direction to count (up/down)</td>
</tr>
<tr>
<td align="center">print</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em><code class="constant">TRUE</code></em></span></td>
<td>Whether or not to print the value</td>
</tr>
<tr>
<td align="center">assign</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center"><span class="emphasis"><em>n/a</em></span></td>
<td>the template variable the output will be assigned to</td>
</tr>
</tbody>
</table></div>
<div class="example">
<a name="id3064970"></a><p class="title"><b>Example 8.4. {counter}</b></p>
<div class="example-contents">
<pre class="programlisting">

{* initialize the count *}
{counter start=0 skip=2}&lt;br /&gt;
{counter}&lt;br /&gt;
{counter}&lt;br /&gt;
{counter}&lt;br /&gt;

  </pre>
<p>
   this will output:
  </p>
<pre class="screen">

0&lt;br /&gt;
2&lt;br /&gt;
4&lt;br /&gt;
6&lt;br /&gt;

  </pre>
</div>
</div>
<br class="example-break">
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.custom.functions.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.custom.functions.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.function.cycle.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 8. Custom Functions </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> {cycle}</td>
</tr>
</table>
</div>
</body>
</html>