PHP Classes


Recommend this page to a friend!
  Classes of wim niemans   Sirenade PHP Template Compiler   Download  
Role: Documentation
Content type: text/markdown
Description: explanation
Class: Sirenade PHP Template Compiler
Compile templates to PHP and caches the results
Author: By
Last change: cosmetic
Date: 3 years ago
Size: 1,777 bytes


Class file image Download

SIRENADE is a base PHP library that compiles the template text into native PHP and caches the compiled output. It is using the package SIREN for basic functions.

SIREN has a simple, sufficient API, performs recursive replacement, and uses an intuitive syntax.  

syntax: {[$|?]var} where var  is [text]{var}[text]  
                   where text is '-._[\w\d\]'

SIRENADE allows for embedding native PHP in the template text and features a nice set of logic directives:

if - elseif - else  
while and loop with count  
for - and foreach struvtures  
increment / decrement counts  
break and continue  
global strings thru sprintf  
set and unset variables (i.e. template variables)
<?php .... ?>  
(experimental) ASP logic

Like SIREN, it features recursion in an intuitive way and extends SIREN's usage with

syntax {!<simple logic>!}
       {!!<advanced logic>!!}
       {# <comments> #}
       <!-- <comments> -->
       <?php <custom native PHP> ?>
       <?= <scalar> ?>
       {$<global string variable> <parameter>}
       <% <ASP logic> %>
       <%= <scalar> %>

SIRENADE has all logic expansions and their syntax externally defined as anonymous functions, and allows for simple custom adjustments, or even complete customised additions. See the directory './logic'.

SIRENADE can cache files and blocks on demand, leaving the SIREN recursion for run time expansion. SIRENADE comes with an extensive set of configurable options.

SIRENADE is very fast, not depending on the number of markers, nor the volume of logic.

More documentation: full readme, api docs, logic, license.