summaryrefslogtreecommitdiff
path: root/example/templates/src/custom_tags.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'example/templates/src/custom_tags.tpl')
-rw-r--r--example/templates/src/custom_tags.tpl19
1 files changed, 19 insertions, 0 deletions
diff --git a/example/templates/src/custom_tags.tpl b/example/templates/src/custom_tags.tpl
new file mode 100644
index 0000000..7e821c5
--- /dev/null
+++ b/example/templates/src/custom_tags.tpl
@@ -0,0 +1,19 @@
+<ste:comment>A foreach that will break after 'max' iterations</ste:comment>
+<ste:mktag name="foreach_limit" mandatory="array|value|max">
+ <ste:foreach array="$_tag_parameters[array]" value="$_tag_parameters[value]" counter="i">
+ <ste:if>
+ <ste:cmp var_a="i" op="gte" var_b="_tag_parameters[max]" />
+ <ste:then>
+ <ste:break />
+ </ste:then>
+ </ste:if>
+
+ <ste:if>
+ $_tag_parameters[counter]
+ <ste:then>
+ <ste:set var="$_tag_parameters[counter]">$i</ste:set>
+ </ste:then>
+ </ste:if>
+ <ste:tagcontent />
+ </ste:foreach>
+</ste:mktag>