summaryrefslogtreecommitdiff
path: root/docs/designers/language-custom-functions/language-function-counter.md
diff options
context:
space:
mode:
authorSimon Wisselink <wisskid@users.noreply.github.com>2021-12-03 11:59:22 +0100
committerGitHub <noreply@github.com>2021-12-03 11:59:22 +0100
commit428a701b1871b02078a663d51a9a6555195743b3 (patch)
tree51a76b654fb742dd9ea1ee6595baa27f113bc7ca /docs/designers/language-custom-functions/language-function-counter.md
parentbaebd59bb4da9fca89da382811b38c8313949c49 (diff)
downloadsmarty-428a701b1871b02078a663d51a9a6555195743b3.tar.gz
smarty-428a701b1871b02078a663d51a9a6555195743b3.tar.bz2
smarty-428a701b1871b02078a663d51a9a6555195743b3.zip
Feature/add docs (#689)
* Add converted docs repo * Set theme jekyll-theme-minimal * Removed BC docs, added TOC * Added TOCs, rewrote most important links in documentation. Linked README to new Github Pages site * some link fixes
Diffstat (limited to 'docs/designers/language-custom-functions/language-function-counter.md')
-rw-r--r--docs/designers/language-custom-functions/language-function-counter.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/designers/language-custom-functions/language-function-counter.md b/docs/designers/language-custom-functions/language-function-counter.md
new file mode 100644
index 00000000..cc1ac08f
--- /dev/null
+++ b/docs/designers/language-custom-functions/language-function-counter.md
@@ -0,0 +1,41 @@
+{counter} {#language.function.counter}
+=========
+
+`{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.
+
+If you supply the `assign` attribute, the output of the `{counter}`
+function will be assigned to this template variable instead of being
+output to the template.
+
+ Attribute Name Type Required Default Description
+ ---------------- --------- ---------- ----------- ------------------------------------------------------
+ name string No *default* The name of the counter
+ start number No *1* The initial number to start counting from
+ skip number No *1* The interval to count by
+ direction string No *up* The direction to count (up/down)
+ print boolean No *TRUE* Whether or not to print the value
+ assign string No *n/a* the template variable the output will be assigned to
+
+
+ {* initialize the count *}
+ {counter start=0 skip=2}<br />
+ {counter}<br />
+ {counter}<br />
+ {counter}<br />
+
+
+
+this will output:
+
+
+ 0<br />
+ 2<br />
+ 4<br />
+ 6<br />
+
+