summaryrefslogtreecommitdiff
path: root/docu/nd/files/stupid_template_engine-php.html
blob: b7b8ea3149d338fd4db644075943292f2db7281f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><title>stupid_template_engine.php</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.4 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="stupid_template_engine.php"></a>stupid_template_engine.php</h1><div class=CBody><p>The implementation of the Stupid Template Engine.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#stupid_template_engine.php" >stupid_template_engine.php</a></td><td class=SDescription>The implementation of the Stupid Template Engine.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>This file is licensed under the MIT/X11 License. </td></tr><tr class="SClass"><td class=SEntry><a href="#ste" >ste</a></td><td class=SDescription>Everything in this file is in this namespace.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#ste.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ste.precompile" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">precompile</a></td><td class=SDescription>Precompiling STE T/PL templates. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ste.parse" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">parse</a></td><td class=SDescription>Parsing a STE T/PL template. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ste.transcompile" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">transcompile</a></td><td class=SDescription>Transcompiles an abstract syntax tree to PHP. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#ste.Constants" >Constants</a></td><td class=SDescription></td></tr><tr class="SConstant SIndent2 SMarked"><td class=SEntry><a href="#ste.Template_modes" >Template modes</a></td><td class=SDescription></td></tr><tr class="SClass"><td class=SEntry><a href="#StorageAccess" >StorageAccess</a></td><td class=SDescription>An interface. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#StorageAccess.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#StorageAccess.load" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">load</a></td><td class=SDescription>Loading a template.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#StorageAccess.save" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">save</a></td><td class=SDescription>Saves a template.</td></tr><tr class="SClass"><td class=SEntry><a href="#FilesystemStorageAccess" >FilesystemStorageAccess</a></td><td class=SDescription>The default <a href="#StorageAccess" class=LClass id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">StorageAccess</a> implementation for loading / saving templates into a directory structure.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#FilesystemStorageAccess.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#FilesystemStorageAccess.__construct" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">__construct</a></td><td class=SDescription></td></tr><tr class="SClass"><td class=SEntry><a href="#STECore" >STECore</a></td><td class=SDescription>The Core of STE</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#STECore.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#STECore.Public_variables" >Public variables</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#STECore.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#STECore.__construct" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">__construct</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#STECore.register_tag" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">register_tag</a></td><td class=SDescription>Register a custom tag.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#STECore.call_tag" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">call_tag</a></td><td class=SDescription>Calling a custom tag (builtin ones can not be called)</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#STECore.exectemplate" id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">exectemplate</a></td><td class=SDescription>Executes a template and returns the result. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#STECore.get_var_reference" id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')">get_var_reference</a></td><td class=SDescription>Get a reference to a template variable using a variable name. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#STECore.set_var_by_name" id=link13 onMouseOver="ShowTip(event, 'tt13', 'link13')" onMouseOut="HideTip('tt13')">set_var_by_name</a></td><td class=SDescription>Set a template variable by its name. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#STECore.get_var_by_name" id=link14 onMouseOver="ShowTip(event, 'tt14', 'link14')" onMouseOut="HideTip('tt14')">get_var_by_name</a></td><td class=SDescription>Get a template variable by its name. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#STECore.load" id=link15 onMouseOver="ShowTip(event, 'tt15', 'link15')" onMouseOut="HideTip('tt15')">load</a></td><td class=SDescription>Load a template and return its result (blocks not included, use <a href="#STECore.exectemplate" class=LFunction id=link16 onMouseOver="ShowTip(event, 'tt11', 'link16')" onMouseOut="HideTip('tt11')">exectemplate</a> for this).</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#STECore.evalbool" id=link17 onMouseOver="ShowTip(event, 'tt16', 'link17')" onMouseOut="HideTip('tt16')">evalbool</a></td><td class=SDescription>Test, if a text represents false (an empty / only whitespace text) or true (everything else).</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="License"></a>License</h3><div class=CBody><p>This file is licensed under the MIT/X11 License.&nbsp; See COPYING for more details.</p></div></div></div>

<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="ste"></a>ste</h2><div class=CBody><p>Everything in this file is in this namespace.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#ste.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#ste.precompile" id=link18 onMouseOver="ShowTip(event, 'tt1', 'link18')" onMouseOut="HideTip('tt1')">precompile</a></td><td class=SDescription>Precompiling STE T/PL templates. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#ste.parse" id=link19 onMouseOver="ShowTip(event, 'tt2', 'link19')" onMouseOut="HideTip('tt2')">parse</a></td><td class=SDescription>Parsing a STE T/PL template. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#ste.transcompile" id=link20 onMouseOver="ShowTip(event, 'tt3', 'link20')" onMouseOut="HideTip('tt3')">transcompile</a></td><td class=SDescription>Transcompiles an abstract syntax tree to PHP. </td></tr><tr class="SGroup"><td class=SEntry><a href="#ste.Constants" >Constants</a></td><td class=SDescription></td></tr><tr class="SConstant SIndent1 SMarked"><td class=SEntry><a href="#ste.Template_modes" >Template modes</a></td><td class=SDescription></td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="ste.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ste.precompile"></a>precompile</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function precompile(</td><td class=PParameter nowrap>$code</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Precompiling STE T/PL templates.&nbsp; You only need this function, if you want to manually transcompile a template.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$code</td><td class=CDLDescription>The input code</td></tr></table><h4 class=CHeading>Returns</h4><p>The precompiled code.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ste.parse"></a>parse</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function parse(</td><td class=PParameter nowrap>$code,</td></tr><tr><td></td><td class=PParameter nowrap>$tpl</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Parsing a STE T/PL template.&nbsp; You only need this function, if you want to manually transcompile a template.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$code</td><td class=CDLDescription>The STE T/PL code.</td></tr><tr><td class=CDLEntry>$tpl</td><td class=CDLDescription>The name of the template.</td></tr></table><h4 class=CHeading>Returns</h4><p>An abstract syntax tree, which can be used with <a href="#ste.transcompile" class=LFunction id=link21 onMouseOver="ShowTip(event, 'tt3', 'link21')" onMouseOut="HideTip('tt3')">transcompile</a>.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ste.transcompile"></a>transcompile</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function transcompile(</td><td class=PParameter nowrap>$ast</td><td class=PAfterParameters nowrap>) /* Transcompile and add some boilerplate code. */</td></tr></table></td></tr></table></blockquote><p>Transcompiles an abstract syntax tree to PHP.&nbsp; You only need this function, if you want to manually transcompile a template.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$ast</td><td class=CDLDescription>The abstract syntax tree to transcompile.</td></tr></table><h4 class=CHeading>Returns</h4><p>PHP code.&nbsp; The PHP code is an anonymous function expecting a <a href="#STECore" class=LClass id=link22 onMouseOver="ShowTip(event, 'tt17', 'link22')" onMouseOut="HideTip('tt17')">STECore</a> instance as its parameter and returns a string (everything that was not pached into a section).</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="ste.Constants"></a>Constants</h3></div></div>

<div class="CConstant"><div class=CTopic><h3 class=CTitle><a name="ste.Template_modes"></a>Template modes</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry><a name="MODE_SOURCE"></a>MODE_SOURCE</td><td class=CDLDescription>The Templates source</td></tr><tr><td class=CDLEntry><a name="MODE_TRANSCOMPILED"></a>MODE_TRANSCOMPILED</td><td class=CDLDescription>The transcompiled template</td></tr></table></div></div></div>

<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="StorageAccess"></a>StorageAccess</h2><div class=CBody><p>An interface.&nbsp; A StorageAccess implementation is used to access the templates from any storage.&nbsp; This means, that you are not limited to store the Templates inside directories, you can also use a database or something else.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#StorageAccess.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#StorageAccess.load" id=link23 onMouseOver="ShowTip(event, 'tt4', 'link23')" onMouseOut="HideTip('tt4')">load</a></td><td class=SDescription>Loading a template.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#StorageAccess.save" id=link24 onMouseOver="ShowTip(event, 'tt5', 'link24')" onMouseOut="HideTip('tt5')">save</a></td><td class=SDescription>Saves a template.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="StorageAccess.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="StorageAccess.load"></a>load</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function load(</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap>$tpl,</td></tr><tr><td></td><td class=PParameterPrefix nowrap>&amp;</td><td class=PParameter nowrap>$mode</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Loading a template.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$tpl</td><td class=CDLDescription>The name of the template.</td></tr><tr><td class=CDLEntry>&amp;$mode</td><td class=CDLDescription>Which mode is preferred?&nbsp; One of the &lt;Template modes&gt;.&nbsp; If &lt;MODE_SOURCE&gt;, the raw sourcecode is expected, if &lt;MODE_TRANSCOMPILED&gt; the transcompiled template <b>as a callable function</b> (expecting an <a href="#STECore" class=LClass id=link25 onMouseOver="ShowTip(event, 'tt17', 'link25')" onMouseOut="HideTip('tt17')">STECore</a> instance as first parameter) is expected.&nbsp; If the transcompiled version is not available or older than the source, you can set this parameter to &lt;MODE_SOURCE&gt; and return the source.</td></tr></table><h4 class=CHeading>Returns</h4><p>Either the sourcecode or a callable function (first, and only parameter: an <a href="#STECore" class=LClass id=link26 onMouseOver="ShowTip(event, 'tt17', 'link26')" onMouseOut="HideTip('tt17')">STECore</a> instance).</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="StorageAccess.save"></a>save</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function save(</td><td class=PParameter nowrap>$tpl,</td></tr><tr><td></td><td class=PParameter nowrap>$data,</td></tr><tr><td></td><td class=PParameter nowrap>$mode</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Saves a template.</p><h4 class=CHeading>Parameters</h4><p>$tpl -The name of the template.&nbsp; $data - The data to be saved.&nbsp; $mode - A &lt;Template mode&gt; constant.</p></div></div></div>

<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="FilesystemStorageAccess"></a>FilesystemStorageAccess</h2><div class=CBody><p>The default <a href="#StorageAccess" class=LClass id=link28 onMouseOver="ShowTip(event, 'tt6', 'link28')" onMouseOut="HideTip('tt6')">StorageAccess</a> implementation for loading / saving templates into a directory structure.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#FilesystemStorageAccess.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#FilesystemStorageAccess.__construct" id=link27 onMouseOver="ShowTip(event, 'tt7', 'link27')" onMouseOut="HideTip('tt7')">__construct</a></td><td class=SDescription></td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="FilesystemStorageAccess.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="FilesystemStorageAccess.__construct"></a>__construct</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function __construct(</td><td class=PParameter nowrap>$src,</td></tr><tr><td></td><td class=PParameter nowrap>$transc</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$src</td><td class=CDLDescription>The directory with the sources (Writing permissions are not mandatory, because STE does not save template sources).</td></tr><tr><td class=CDLEntry>$transc</td><td class=CDLDescription>The directory with the transcompiled templates (the PHP instance / the HTTP Server needs writing permissions to this directory).</td></tr></table></div></div></div>

<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="STECore"></a>STECore</h2><div class=CBody><p>The Core of STE</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#STECore.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent1 SMarked"><td class=SEntry><a href="#STECore.Public_variables" >Public variables</a></td><td class=SDescription></td></tr><tr class="SGroup"><td class=SEntry><a href="#STECore.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#STECore.__construct" id=link29 onMouseOver="ShowTip(event, 'tt8', 'link29')" onMouseOut="HideTip('tt8')">__construct</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#STECore.register_tag" id=link30 onMouseOver="ShowTip(event, 'tt9', 'link30')" onMouseOut="HideTip('tt9')">register_tag</a></td><td class=SDescription>Register a custom tag.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#STECore.call_tag" id=link31 onMouseOver="ShowTip(event, 'tt10', 'link31')" onMouseOut="HideTip('tt10')">call_tag</a></td><td class=SDescription>Calling a custom tag (builtin ones can not be called)</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#STECore.exectemplate" id=link32 onMouseOver="ShowTip(event, 'tt11', 'link32')" onMouseOut="HideTip('tt11')">exectemplate</a></td><td class=SDescription>Executes a template and returns the result. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#STECore.get_var_reference" id=link33 onMouseOver="ShowTip(event, 'tt12', 'link33')" onMouseOut="HideTip('tt12')">get_var_reference</a></td><td class=SDescription>Get a reference to a template variable using a variable name. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#STECore.set_var_by_name" id=link34 onMouseOver="ShowTip(event, 'tt13', 'link34')" onMouseOut="HideTip('tt13')">set_var_by_name</a></td><td class=SDescription>Set a template variable by its name. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#STECore.get_var_by_name" id=link35 onMouseOver="ShowTip(event, 'tt14', 'link35')" onMouseOut="HideTip('tt14')">get_var_by_name</a></td><td class=SDescription>Get a template variable by its name. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#STECore.load" id=link36 onMouseOver="ShowTip(event, 'tt15', 'link36')" onMouseOut="HideTip('tt15')">load</a></td><td class=SDescription>Load a template and return its result (blocks not included, use <a href="#STECore.exectemplate" class=LFunction id=link37 onMouseOver="ShowTip(event, 'tt11', 'link37')" onMouseOut="HideTip('tt11')">exectemplate</a> for this).</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#STECore.evalbool" id=link38 onMouseOver="ShowTip(event, 'tt16', 'link38')" onMouseOut="HideTip('tt16')">evalbool</a></td><td class=SDescription>Test, if a text represents false (an empty / only whitespace text) or true (everything else).</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="STECore.Variables"></a>Variables</h3></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="STECore.Public_variables"></a>Public variables</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry><a name="$blocks"></a>$blocks</td><td class=CDLDescription>Associative array of blocks (see the language definition).</td></tr><tr><td class=CDLEntry><a name="$blockorder"></a>$blockorder</td><td class=CDLDescription>The order of the blocks (an array)</td></tr><tr><td class=CDLEntry><a name="$vars"></a>$vars</td><td class=CDLDescription>Associative array of all template variables.&nbsp; Use this to pass data to your templates.</td></tr></table></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="STECore.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.__construct"></a>__construct</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function __construct(</td><td class=PParameter nowrap>$storage_access</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$storage_access</td><td class=CDLDescription>An Instance of a <a href="#StorageAccess" class=LClass id=link39 onMouseOver="ShowTip(event, 'tt6', 'link39')" onMouseOut="HideTip('tt6')">StorageAccess</a> implementation.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.register_tag"></a>register_tag</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function register_tag(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$callback</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Register a custom tag.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$name</td><td class=CDLDescription>The name of the tag.</td></tr><tr><td class=CDLEntry>$callback</td><td class=CDLDescription>A callable function (This must tage three parameters: The <a href="#STECore" class=LClass id=link40 onMouseOver="ShowTip(event, 'tt17', 'link40')" onMouseOut="HideTip('tt17')">STECore</a> instance, an associative array of parameters, and a function representing the tags content(This expects the <a href="#STECore" class=LClass id=link41 onMouseOver="ShowTip(event, 'tt17', 'link41')" onMouseOut="HideTip('tt17')">STECore</a> instance as its only parameter and returns its text result, i.e to get the text, you neeed to call this function with the <a href="#STECore" class=LClass id=link42 onMouseOver="ShowTip(event, 'tt17', 'link42')" onMouseOut="HideTip('tt17')">STECore</a> instance as a parameter)).</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.call_tag"></a>call_tag</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function call_tag(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$params,</td></tr><tr><td></td><td class=PParameter nowrap>$sub</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Calling a custom tag (builtin ones can not be called)</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$name</td><td class=CDLDescription>The Tag&rsquo;s name</td></tr><tr><td class=CDLEntry>$params</td><td class=CDLDescription>Associative array of parameters</td></tr><tr><td class=CDLEntry>$sub</td><td class=CDLDescription>A callable function (expecting an <a href="#STECore" class=LClass id=link43 onMouseOver="ShowTip(event, 'tt17', 'link43')" onMouseOut="HideTip('tt17')">STECore</a> instance as it&rsquo;s parameter) that represents the tag&rsquo;s content.</td></tr></table><h4 class=CHeading>Returns</h4><p>The output of the tag.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.exectemplate"></a>exectemplate</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function exectemplate(</td><td class=PParameter nowrap>$tpl</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Executes a template and returns the result.&nbsp; The huge difference to <a href="#STECore.load" class=LFunction id=link44 onMouseOver="ShowTip(event, 'tt15', 'link44')" onMouseOut="HideTip('tt15')">load</a> is that this function will also output all blocks.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$tpl</td><td class=CDLDescription>The name of the template to execute.</td></tr></table><h4 class=CHeading>Returns</h4><p>The output of the template.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.get_var_reference"></a>get_var_reference</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function &amp;get_var_reference(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$create_if_not_exist</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Get a reference to a template variable using a variable name.&nbsp; This can be used,if your custom tag takes a variable name as a parameter.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$name</td><td class=CDLDescription>The variables name.</td></tr><tr><td class=CDLEntry>$create_if_not_exist</td><td class=CDLDescription>Should the variable be created, if it does not exist?&nbsp; Otherwise NULL will be returned, if the variable does not exist.</td></tr></table><h4 class=CHeading>Returns</h4><p>A Reference to the variable.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.set_var_by_name"></a>set_var_by_name</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function set_var_by_name(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Set a template variable by its name.&nbsp; This can be used,if your custom tag takes a variable name as a parameter.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$name</td><td class=CDLDescription>The variables name.</td></tr><tr><td class=CDLEntry>$val</td><td class=CDLDescription>The new value.</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.get_var_by_name"></a>get_var_by_name</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function get_var_by_name(</td><td class=PParameter nowrap>$name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Get a template variable by its name.&nbsp; This can be used,if your custom tag takes a variable name as a parameter.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$name</td><td class=CDLDescription>The variables name.</td></tr></table><h4 class=CHeading>Returns</h4><p>The variables value.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.load"></a>load</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function load(</td><td class=PParameter nowrap>$tpl,</td><td class=PDefaultValuePrefix>&nbsp;&nbsp;</td><td class=PDefaultValue width=100%></td></tr><tr><td></td><td class=PParameter nowrap>$quiet</td><td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td><td class=PDefaultValue width=100%>False</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Load a template and return its result (blocks not included, use <a href="#STECore.exectemplate" class=LFunction id=link45 onMouseOver="ShowTip(event, 'tt11', 'link45')" onMouseOut="HideTip('tt11')">exectemplate</a> for this).</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$tpl</td><td class=CDLDescription>The name of the template to be loaded.</td></tr><tr><td class=CDLEntry>$quiet</td><td class=CDLDescription>If true, do not output anything and do notmodify the blocks.&nbsp; This can be useful to load custom tags that are programmed in STE T/PL.&nbsp; Default: false.</td></tr></table><h4 class=CHeading>Returns</h4><p>The result of the template (if $quiet == false).</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="STECore.evalbool"></a>evalbool</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function evalbool(</td><td class=PParameter nowrap>$txt</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Test, if a text represents false (an empty / only whitespace text) or true (everything else).</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$txt</td><td class=CDLDescription>The text to test.</td></tr></table><h4 class=CHeading>Returns</h4><p>true/false.</p></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile id=MSelected>stupid_template_engine.php</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Constants.html">Constants</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Constants">Constants</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Variables">Variables</option></select></div></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function precompile(</td><td class=PParameter nowrap>$code</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Precompiling STE T/PL templates. </div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function parse(</td><td class=PParameter nowrap>$code,</td></tr><tr><td></td><td class=PParameter nowrap>$tpl</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Parsing a STE T/PL template. </div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>function transcompile(</td><td class=PParameter nowrap>$ast</td><td class=PAfterParameters nowrap>) /* Transcompile and add some boilerplate code. */</td></tr></table></td></tr></table></blockquote>Transcompiles an abstract syntax tree to PHP. </div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function load(</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap>$tpl,</td></tr><tr><td></td><td class=PParameterPrefix nowrap>&amp;</td><td class=PParameter nowrap>$mode</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Loading a template.</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function save(</td><td class=PParameter nowrap>$tpl,</td></tr><tr><td></td><td class=PParameter nowrap>$data,</td></tr><tr><td></td><td class=PParameter nowrap>$mode</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Saves a template.</div></div><div class=CToolTip id="tt6"><div class=CClass>An interface. </div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function __construct(</td><td class=PParameter nowrap>$src,</td></tr><tr><td></td><td class=PParameter nowrap>$transc</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote></div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function __construct(</td><td class=PParameter nowrap>$storage_access</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote></div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function register_tag(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$callback</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Register a custom tag.</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function call_tag(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$params,</td></tr><tr><td></td><td class=PParameter nowrap>$sub</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Calling a custom tag (builtin ones can not be called)</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function exectemplate(</td><td class=PParameter nowrap>$tpl</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Executes a template and returns the result. </div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function &amp;get_var_reference(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$create_if_not_exist</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Get a reference to a template variable using a variable name. </div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function set_var_by_name(</td><td class=PParameter nowrap>$name,</td></tr><tr><td></td><td class=PParameter nowrap>$val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Set a template variable by its name. </div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function get_var_by_name(</td><td class=PParameter nowrap>$name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Get a template variable by its name. </div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function load(</td><td class=PParameter nowrap>$tpl,</td><td class=PDefaultValuePrefix>&nbsp;&nbsp;</td><td class=PDefaultValue width=100%></td></tr><tr><td></td><td class=PParameter nowrap>$quiet</td><td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td><td class=PDefaultValue width=100%>False</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Load a template and return its result (blocks not included, use exectemplate for this).</div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>public function evalbool(</td><td class=PParameter nowrap>$txt</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Test, if a text represents false (an empty / only whitespace text) or true (everything else).</div></div><div class=CToolTip id="tt17"><div class=CClass>The Core of STE</div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>