]> git.andy128k.dev Git - ipf.git/commitdiff
template documentation
authorAndrey Kutejko <andy128k@gmail.com>
Sun, 16 Jun 2013 18:52:28 +0000 (21:52 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sun, 16 Jun 2013 18:52:28 +0000 (21:52 +0300)
doc/template.org [new file with mode: 0644]

diff --git a/doc/template.org b/doc/template.org
new file mode 100644 (file)
index 0000000..3171e2f
--- /dev/null
@@ -0,0 +1,93 @@
+* Template
+
+** Tags
+
+*** {<expr>[modifiers]}
+    Outputs expression.
+
+*** {if <condition>} | {elseif <condition>} | {else} | {/if}
+
+*** {while <condition>} | {/while}
+
+*** {foreach <collection> as [<key> =>] <value>} | {/foreach}
+    Iterate over collection.
+    Following variables are defined inside a loop:
+    foreach_counter0 -- zero based iteration counter
+    foreach_counter1 -- unit based iteration counter
+    foreach_first -- is true on first iteration and false on the rest ones.
+
+*** {assign <var> <eq-op> <expr>}
+    Example: {assing $v += 1}
+
+*** {literal} | {/literal}
+    Literally output enclosed text. Mostly used to wrap inlined JavaScript.
+
+*** {include "<filename>"}
+    Include another template. Example: {include "pagination.html"}
+
+*** {block <name>} | {superblock} | {/block}
+
+*** {ldelim} | {rdelim}
+    Output '{' and '}'.
+
+** Unknown Tags
+
+*** {trans} | {plural} | {blocktrans} | {/blocktrans}
+
+** Predefined custom tags
+
+*** {url '<view-name>'[, array(<arg>, ...)]}
+    Reverse url
+
+*** {sql}
+    Prints SQL statistics.
+
+** Modifiers
+
+   Modifier is a transformation applied to a printed value.
+   Some modifiers have one or more parameters.
+
+   {<expr> [|<modifier>[:<params>]]*}
+
+   Where <params> is a comma-separated list of parameters.
+
+   Examples: {$content|safe}, {$content|strip_tags|limit_words:10}
+
+*** Predefined modifiers
+
+    upper
+    lower
+    capitalize
+    trim
+
+    limit_words:<count>,<end> -- Limits text to specified number of words (default is 100). Text is terminted by <end> string (default is ellipsis character).
+
+    date:<format> -- format date. Default format is '%b %e, %Y'
+    time:<format> -- format date and time. Default format is 'Y-m-d H:i:s'
+
+    floatformat:<decimals>,<point><thousands> -- format float value. Default parameters are 2, '.', ','.
+
+    count -- number of elements in collection
+
+    escxml -- escape XM
+    escape -- escape HTML
+    escurl -- escape URL
+    strip_tags -- remove all tags
+    nl2br -- replaces all new line characters with '<br>' tags
+    unsafe, safe -- outputs text unescaped
+
+    debug -- print_r
+    fulldebug -- var_export
+
+** Configuration
+
+   template_tags -- additional template tags
+
+   template_modifiers -- additional template modifiers
+
+   template_context_processors -- list of context processors
+
+   template_dirs -- list of directories to look for template files. By default it contains 'templates' folder in project directory and 'templates' folder in IPF_Admin application (when it is enabled).
+
+   debug -- forces to recompile template before each rendering
+