Recommend this page to a friend! |
Classes of wim niemans | Sirenade PHP Template Compiler | sirenade.usage.md | Download |
|
DownloadIntroductionA lot of template engines just replace markers in a text by other text. The concept of boilerplate is their base feature. SIRENADE is built on SIREN, that does the intelligent replacing. Please refer to the package SIREN for basic syntax of markers and variables. SIRENADE adds logic to the replacement algorithms, and caches files and blocks. But above all, SIRENADE will compile the input template into native PHP code and invokes a secure eval to produce the content. Two base classes are available: Template to compile the template text and Stencil to cache the compiled result. This means that Stencil invokes Template whenever the input template text is not yet cached, or retrieves the cached result. The effect is that a first run of Stencil is always slower than all other following runs. BenefitsBenefits of SIRENADE include:
Logic Syntax ConventionsSIRENADE supports:
Like SIREN, the brackets convention is used for simple and advanced logic. SIRENADE extends this with a XML like convention for native PHP tags and ASP coding syles.
LogicSimple Logic{!if myVar} myVar exists {!else) myVar is an orphan {!endif) {!if {myVar}} myVar has value {myVar} and exists {!else) myVar or {myVar} is an orphan {!endif) {!while myVar} the value of myVar is {myVar}. {!unset myVar} {!endwhile} {!while myVar} the value of myVar is {myVar}. {!break} {!endwhile} {!loop 5} five times. {!endloop) {{!loop myVar} {myVar} times. {!endloop) Advanced Logic{!if myVar == 'abc' } myVar equals 'abc' {!else) myVar does not equal 'abc' {!endif) {!if {myVar} == 'abc' } the value {myVar} of myVar equals 'abc' {!else) the value of myVar {myVar} does not equal 'abc' {!endif) ASP Logic<% for language in languages%> <%= language %> <% endfor %> <% for language in {languages} %> <%= language %> <% endfor %> <% for {language} in {languages} %> <%= {language} %> <% endfor %> Native CodePHP native codeScalarCommentsExtended methodsFormatting a Global VariableObject Access |