From: Andrey Kutejko Date: Sun, 16 Jun 2013 18:52:28 +0000 (+0300) Subject: template documentation X-Git-Tag: 0.5~235 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=8c5bf45f2d0ae2a1d6fadd6f6d457ebefdc71d90;p=ipf.git template documentation --- diff --git a/doc/template.org b/doc/template.org new file mode 100644 index 0000000..3171e2f --- /dev/null +++ b/doc/template.org @@ -0,0 +1,93 @@ +* Template + +** Tags + +*** {[modifiers]} + Outputs expression. + +*** {if } | {elseif } | {else} | {/if} + +*** {while } | {/while} + +*** {foreach as [ =>] } | {/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 } + Example: {assing $v += 1} + +*** {literal} | {/literal} + Literally output enclosed text. Mostly used to wrap inlined JavaScript. + +*** {include ""} + Include another template. Example: {include "pagination.html"} + +*** {block } | {superblock} | {/block} + +*** {ldelim} | {rdelim} + Output '{' and '}'. + +** Unknown Tags + +*** {trans} | {plural} | {blocktrans} | {/blocktrans} + +** Predefined custom tags + +*** {url ''[, array(, ...)]} + Reverse url + +*** {sql} + Prints SQL statistics. + +** Modifiers + + Modifier is a transformation applied to a printed value. + Some modifiers have one or more parameters. + + { [|[:]]*} + + Where is a comma-separated list of parameters. + + Examples: {$content|safe}, {$content|strip_tags|limit_words:10} + +*** Predefined modifiers + + upper + lower + capitalize + trim + + limit_words:, -- Limits text to specified number of words (default is 100). Text is terminted by string (default is ellipsis character). + + date: -- format date. Default format is '%b %e, %Y' + time: -- format date and time. Default format is 'Y-m-d H:i:s' + + floatformat:, -- 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 '
' 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 +