summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docu/language_definition.html19
-rw-r--r--docu/nd/files/stupid_template_engine-php.html12
-rw-r--r--example/templates/transc/articles.html.php172
-rw-r--r--example/templates/transc/custom_tags.tpl.php65
-rw-r--r--example/templates/transc/master.html.php503
-rw-r--r--stupid_template_engine.php38
6 files changed, 803 insertions, 6 deletions
diff --git a/docu/language_definition.html b/docu/language_definition.html
index c4dd98b..4cf4aaf 100644
--- a/docu/language_definition.html
+++ b/docu/language_definition.html
@@ -77,6 +77,10 @@
<li><a href="#stdlib_inc">ste:inc</a></li>
<li><a href="#stdlib_dec">ste:dec</a></li>
<li><a href="#stdlib_date">ste:date</a></li>
+ <li><a href="#stdlib_in_array">ste:in_array</a></li>
+ <li><a href="#stdlib_join">ste:join</a></li>
+ <li><a href="#stdlib_split">ste:split</a></li>
+ <li><a href="#stdlib_array_add">ste:array_add</a></li>
</ol>
</li>
</ol>
@@ -498,5 +502,20 @@
Result:<br />
<code><pre>18. Sep. 2011, 16:49:20</pre></code>
</p>
+
+ <h3 id="stdlib_in_array">ste:in_array</h3>
+ <p>Check, if a value is in an array. The tag takes the variable name of the array by parameter <code>array</code>.The value to test with will be taken from the tags content.</p>
+ <p>Returns empty text, if the value is not in the array, otherwise a non-empty text.</p>
+
+ <h3 id="stdlib_join">ste:join</h3>
+ <p>Join parts of an array together. The array's variable name goes to the <code>array</code> parameter. The tag's content will be used as the glue, i.e. this will be between two elements.</p>
+ <p>Returns the joined array</p>
+
+ <h3 id="stdlib_split">ste:split</h3>
+ <p>Split a text and write the parts to an array. The <code>array</code> parameter takes the variable name of the resulting array, the <code>delim</code> parameter the text to split by. The tag's content will be the text to split.</p>
+
+ <h3 id="stdlib_array_add">ste:array_add</h3>
+ <p>Adding an element to an array. The <code>array</code> parameter takes the variable name of the array. The <code>key</code> parameter takes the array key to map the value to, if omitted, the value will be appended to the end of the array. The value is the tag's content.</p>
+
</body>
</html>
diff --git a/docu/nd/files/stupid_template_engine-php.html b/docu/nd/files/stupid_template_engine-php.html
index 2d68e6b..1567591 100644
--- a/docu/nd/files/stupid_template_engine-php.html
+++ b/docu/nd/files/stupid_template_engine-php.html
@@ -63,17 +63,17 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
<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=link50 onMouseOver="ShowTip(event, 'tt18', 'link50')" onMouseOut="HideTip('tt18')">STECore</a> instance, an associative array of parameters, and a function representing the tags content(This expects the <a href="#STECore" class=LClass id=link51 onMouseOver="ShowTip(event, 'tt18', 'link51')" onMouseOut="HideTip('tt18')">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=link52 onMouseOver="ShowTip(event, 'tt18', 'link52')" onMouseOut="HideTip('tt18')">STECore</a> instance as a parameter)).</td></tr></table><h4 class=CHeading>Throws</h4><p>An Exception if the tag could not be registered (if $callback is not callable or if $name is empty)</p></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=link53 onMouseOver="ShowTip(event, 'tt18', 'link53')" onMouseOut="HideTip('tt18')">STECore</a> instance as it&rsquo;s parameter) that represents the tag&rsquo;s content.</td></tr></table><h4 class=CHeading>Throws</h4><p>Might throw a <a href="#FatalRuntimeError" class=LClass id=link54 onMouseOver="ShowTip(event, 'tt22', 'link54')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a>.</p><h4 class=CHeading>Returns</h4><p>The output of the tag or, if a <a href="#RuntimeError" class=LClass id=link55 onMouseOver="ShowTip(event, 'tt21', 'link55')" onMouseOut="HideTip('tt21')">RuntimeError</a> was thrown, the appropiate result (see &lt;$mute_runtime_errors&gt;).</p></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=link53 onMouseOver="ShowTip(event, 'tt18', 'link53')" onMouseOut="HideTip('tt18')">STECore</a> instance as it&rsquo;s parameter) that represents the tag&rsquo;s content.</td></tr></table><h4 class=CHeading>Throws</h4><p>Might throw a <a href="#FatalRuntimeError" class=LClass id=link54 onMouseOver="ShowTip(event, 'tt22', 'link54')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> (see <a href="#STECore.$fatal_error_on_missing_tag" class=LVariable id=link55 onMouseOver="ShowTip(event, 'tt23', 'link55')" onMouseOut="HideTip('tt23')">$fatal_error_on_missing_tag</a>.</p><h4 class=CHeading>Returns</h4><p>The output of the tag or, if a <a href="#RuntimeError" class=LClass id=link56 onMouseOver="ShowTip(event, 'tt21', 'link56')" onMouseOut="HideTip('tt21')">RuntimeError</a> was thrown, the appropiate result (see &lt;$mute_runtime_errors&gt;).</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=link56 onMouseOver="ShowTip(event, 'tt15', 'link56')" 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.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=link57 onMouseOver="ShowTip(event, 'tt15', 'link57')" 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>Throws</h4><ul><li>A <a href="#CantLoadTemplate" class=LClass id=link58 onMouseOver="ShowTip(event, 'tt19', 'link58')" onMouseOut="HideTip('tt19')">CantLoadTemplate</a> exception if the template could not be loaded.</li><li>A &lt;ParseCompileError&gt; if the template could not be parsed or transcompiled.</li><li>A <a href="#FatalRuntimeError" class=LClass id=link59 onMouseOver="ShowTip(event, 'tt22', 'link59')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> if a tag threw it or if a tag was not found and <a href="#STECore.$fatal_error_on_missing_tag" class=LVariable id=link60 onMouseOver="ShowTip(event, 'tt23', 'link60')" onMouseOut="HideTip('tt23')">$fatal_error_on_missing_tag</a> is true.</li><li>Might also throw different exceptions, if a external tag threw it (but they should use <a href="#RuntimeError" class=LClass id=link61 onMouseOver="ShowTip(event, 'tt21', 'link61')" onMouseOut="HideTip('tt21')">RuntimeError</a> or <a href="#FatalRuntimeError" class=LClass id=link62 onMouseOver="ShowTip(event, 'tt22', 'link62')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> to make it possible for STE to handle them correctly).</li></ul><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>Throws</h4><p><a href="#RuntimeError" class=LClass id=link57 onMouseOver="ShowTip(event, 'tt21', 'link57')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</p><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.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>Throws</h4><p><a href="#RuntimeError" class=LClass id=link63 onMouseOver="ShowTip(event, 'tt21', 'link63')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</p><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><h4 class=CHeading>Throws</h4><p><a href="#RuntimeError" class=LClass id=link58 onMouseOver="ShowTip(event, 'tt21', 'link58')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</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><h4 class=CHeading>Throws</h4><p><a href="#RuntimeError" class=LClass id=link64 onMouseOver="ShowTip(event, 'tt21', 'link64')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</p></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>Throws</h4><p><a href="#RuntimeError" class=LClass id=link59 onMouseOver="ShowTip(event, 'tt21', 'link59')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</p><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.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>Throws</h4><p><a href="#RuntimeError" class=LClass id=link65 onMouseOver="ShowTip(event, 'tt21', 'link65')" onMouseOut="HideTip('tt21')">RuntimeError</a> if the variable name can not be parsed (e.g. unbalanced brackets).</p><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=link60 onMouseOver="ShowTip(event, 'tt11', 'link60')" 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>Throws</h4><ul><li>A <a href="#FatalRuntimeError" class=LClass id=link61 onMouseOver="ShowTip(event, 'tt22', 'link61')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> if a tag threw it or, if <a href="#STECore.$fatal_error_on_missing_tag" class=LVariable id=link62 onMouseOver="ShowTip(event, 'tt23', 'link62')" onMouseOut="HideTip('tt23')">$fatal_error_on_missing_tag</a> is True, a non-existant tag was called.</li></ul><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.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=link66 onMouseOver="ShowTip(event, 'tt11', 'link66')" 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>Throws</h4><ul><li>A <a href="#CantLoadTemplate" class=LClass id=link67 onMouseOver="ShowTip(event, 'tt19', 'link67')" onMouseOut="HideTip('tt19')">CantLoadTemplate</a> exception if the template could not be loaded.</li><li>A &lt;ParseCompileError&gt; if the template could not be parsed or transcompiled.</li><li>A <a href="#FatalRuntimeError" class=LClass id=link68 onMouseOver="ShowTip(event, 'tt22', 'link68')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> if a tag threw it or if a tag was not found and <a href="#STECore.$fatal_error_on_missing_tag" class=LVariable id=link69 onMouseOver="ShowTip(event, 'tt23', 'link69')" onMouseOut="HideTip('tt23')">$fatal_error_on_missing_tag</a> is true.</li><li>Might also throw different exceptions, if a external tag threw it (but they should use <a href="#RuntimeError" class=LClass id=link70 onMouseOver="ShowTip(event, 'tt21', 'link70')" onMouseOut="HideTip('tt21')">RuntimeError</a> or <a href="#FatalRuntimeError" class=LClass id=link71 onMouseOver="ShowTip(event, 'tt22', 'link71')" onMouseOut="HideTip('tt22')">FatalRuntimeError</a> to make it possible for STE to handle them correctly).</li></ul><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>
diff --git a/example/templates/transc/articles.html.php b/example/templates/transc/articles.html.php
new file mode 100644
index 0000000..d52658c
--- /dev/null
+++ b/example/templates/transc/articles.html.php
@@ -0,0 +1,172 @@
+<?php $transcompile_fx = function($ste)
+{
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= $ste->load("custom_tags.tpl");
+ $outputstack[$outputstack_i] .= $ste->load("master.html");
+ $blockname_4feb57c8eb53c0_39108239 = "content";
+ $ste->blocks['4feb57c8eb54f8.57715029'] = array_pop($outputstack);
+ $ste->blockorder[] = '4feb57c8eb54f8.57715029';
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<h2>Some Articles</h2>\n\t";
+ $parameters_4feb57c8eb55d1_49937129 = array();
+ $parameters_4feb57c8eb55d1_49937129['array'] = "articles";
+ $parameters_4feb57c8eb55d1_49937129['value'] = "article";
+ $parameters_4feb57c8eb55d1_49937129['max'] = "3";
+ $parameters_4feb57c8eb55d1_49937129['counter'] = "i";
+ $outputstack[$outputstack_i] .= $ste->call_tag('foreach_limit', $parameters_4feb57c8eb55d1_49937129, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<h3>";
+ $parameters_4feb57c8eb59c3_59434363 = array();
+ $outputstack[$outputstack_i] .= $ste->call_tag('uppercase', $parameters_4feb57c8eb59c3_59434363, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $parameters_4feb57c8eb5a98_71645476 = array();
+ $outputstack[$outputstack_i] .= $ste->call_tag('escape', $parameters_4feb57c8eb5a98_71645476, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= @$ste->vars["article"]["title"];
+ return array_pop($outputstack);
+ });
+ return array_pop($outputstack);
+ });
+ $outputstack[$outputstack_i] .= "</h3>\n\t\t<div class=\"author\">Author: ";
+ $parameters_4feb57c8eb5f92_71020272 = array();
+ $outputstack[$outputstack_i] .= $ste->call_tag('escape', $parameters_4feb57c8eb5f92_71020272, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= @$ste->vars["article"]["author"];
+ return array_pop($outputstack);
+ });
+ $outputstack[$outputstack_i] .= "</div>\n\t\t<div class=\"date\">";
+ $parameters_4feb57c8eb62b8_11002450 = array();
+ $parameters_4feb57c8eb62b8_11002450['timestamp'] = @$ste->vars["article"]["timestamp"];
+ $outputstack[$outputstack_i] .= $ste->call_tag('date', $parameters_4feb57c8eb62b8_11002450, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "%d. %h. %Y, %H:%M:%S";
+ return array_pop($outputstack);
+ });
+ $outputstack[$outputstack_i] .= "</div>\n\t\t<div class=\"article_content\">\n\t\t\t";
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= (($ste->get_var_by_name("i")) == ("0")) ? 'yes' : '';
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[$outputstack_i] .= "\n\t\t\t\t\t" . @$ste->vars["article"]["full"];
+
+ }
+ else
+ {
+ $outputstack[$outputstack_i] .= "\n\t\t\t\t\t" . @$ste->vars["article"]["excerpt"];
+
+ }
+ $outputstack[$outputstack_i] .= "</div>\n\t\t<hr />\n\t";
+ return array_pop($outputstack);
+ });
+ $outputstack[] = '';
+ $outputstack_i++;
+ $parameters_4feb57c8eb72f3_12728934 = array();
+ $parameters_4feb57c8eb72f3_12728934['array'] = "articles";
+ $outputstack[$outputstack_i] .= $ste->call_tag('arraylen', $parameters_4feb57c8eb72f3_12728934, function($ste) { return ''; });
+ $outputstack_i--;
+ $ste->set_var_by_name("articles_n", array_pop($outputstack));
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= ((@$ste->vars["articles_n"]) > ("3")) ? 'yes' : '';
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[$outputstack_i] .= "<p>There are <a href=\"#\">more articles</a>.</p>\n\t\t";
+
+ }
+ $outputstack[$outputstack_i] .= "<h2>Some more useless demo stuff...</h2>\n\t\t<h3>Counting from 10 to 0...</h3>\n\t\t<p>but take only the even ones and multiply by 5...</p>\n\t\t";
+ $forloop_4feb57c8eb7965_88913250_start = "10";
+ $forloop_4feb57c8eb7965_88913250_stop = "0";
+ $forloop_4feb57c8eb7965_88913250_countername = "i";
+ for($forloop_4feb57c8eb7965_88913250_counter = $forloop_4feb57c8eb7965_88913250_start; $forloop_4feb57c8eb7965_88913250_counter >= $forloop_4feb57c8eb7965_88913250_stop; $forloop_4feb57c8eb7965_88913250_counter += -1)
+ {
+ try
+ {
+ $ste->set_var_by_name($forloop_4feb57c8eb7965_88913250_countername, $forloop_4feb57c8eb7965_88913250_counter);
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[] = '';
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= @$ste->vars["i"];
+ $outputstack_i--;
+ $tmp_even = array_pop($outputstack);
+ $outputstack[$outputstack_i] .= (is_numeric($tmp_even) and ($tmp_even % 2 == 0)) ? 'yes' : '';
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[] = '';
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= @$ste->vars["i"] . " * 5";
+ $outputstack_i--;
+ $outputstack[$outputstack_i] .= $ste->calc(array_pop($outputstack));
+ $outputstack[$outputstack_i] .= "<br />\n\t\t\t\t";
+
+ }
+
+ }
+ catch(\ste\BreakException $e) { break; }
+ catch(\ste\ContinueException $e) { continue; }
+
+ }
+
+ $outputstack[$outputstack_i] .= "<h3>Repeat some text...</h3>\n\t\t";
+ $parameters_4feb57c8eb86f4_27000372 = array();
+ $parameters_4feb57c8eb86f4_27000372['n'] = "10";
+ $outputstack[$outputstack_i] .= $ste->call_tag('repeat', $parameters_4feb57c8eb86f4_27000372, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<p>Bla</p>\n\t\t";
+ return array_pop($outputstack);
+ });
+ $outputstack[$outputstack_i] .= "<h3>Get a variable's content dynamically</h3>\n\t\t";
+ $outputstack[$outputstack_i] .= $ste->get_var_by_name(@$ste->vars["foo"] . "[" . @$ste->vars["bar"] . "]");$outputstack[$outputstack_i] .= "<h3>We will call ste:repeat with a non-numerical value for n here to see the handling of a RuntimeError</h3>\n\t\t";
+ $parameters_4feb57c8eb8be8_11772552 = array();
+ $parameters_4feb57c8eb8be8_11772552['n'] = "lol";
+ $outputstack[$outputstack_i] .= $ste->call_tag('repeat', $parameters_4feb57c8eb8be8_11772552, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<p>Bla</p>\n\t\t";
+ return array_pop($outputstack);
+ });
+ $parameters_4feb57c8eb8e64_48510077 = array();
+ $parameters_4feb57c8eb8e64_48510077['array'] = "hai";
+ $parameters_4feb57c8eb8e64_48510077['delim'] = ",";
+ $outputstack[$outputstack_i] .= $ste->call_tag('split', $parameters_4feb57c8eb8e64_48510077, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "a,b,c,d,e";
+ return array_pop($outputstack);
+ });
+ $parameters_4feb57c8eb91f2_76021324 = array();
+ $parameters_4feb57c8eb91f2_76021324['array'] = "hai";
+ $outputstack[$outputstack_i] .= $ste->call_tag('join', $parameters_4feb57c8eb91f2_76021324, function($ste)
+ {
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<br />";
+ return array_pop($outputstack);
+ });
+ $ste->blocks[$blockname_4feb57c8eb53c0_39108239] = array_pop($outputstack);
+ if(array_search($blockname_4feb57c8eb53c0_39108239, $ste->blockorder) === FALSE)
+ $ste->blockorder[] = $blockname_4feb57c8eb53c0_39108239;
+ $outputstack = array('');
+ $outputstack_i = 0;
+ return array_pop($outputstack);
+}; ?> \ No newline at end of file
diff --git a/example/templates/transc/custom_tags.tpl.php b/example/templates/transc/custom_tags.tpl.php
new file mode 100644
index 0000000..b92f8a3
--- /dev/null
+++ b/example/templates/transc/custom_tags.tpl.php
@@ -0,0 +1,65 @@
+<?php $transcompile_fx = function($ste)
+{
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[] = '';
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= "array|value|max";
+ $outputstack_i--;
+ $mandatory_params = explode('|', array_pop($outputstack));
+ $tag_fx = function($ste, $params, $sub) use ($mandatory_params)
+ {
+ $outputstack = array(); $outputstack_i = 0;$ste->vars['_tag_parameters'] = $params;
+ foreach($mandatory_params as $mp)
+ {
+ if(!isset($params[$mp]))
+ throw new \ste\RuntimeError("$mp missing in <ste:" . "foreach_limit" . ">.");
+ }$foreachloop_4f4e9064144651_57761022_arrayvar = @$ste->vars["_tag_parameters"]["array"];
+ $foreachloop_4f4e9064144651_57761022_valuevar = @$ste->vars["_tag_parameters"]["value"];
+ $foreachloop_4f4e9064144651_57761022_countervar = "i";
+ $foreachloop_4f4e9064144651_57761022_array = $ste->get_var_by_name($foreachloop_4f4e9064144651_57761022_arrayvar);
+ if(!is_array($foreachloop_4f4e9064144651_57761022_array))
+ $foreachloop_4f4e9064144651_57761022_array = array();
+ $foreachloop_4f4e9064144651_57761022_counter = -1;
+ foreach($foreachloop_4f4e9064144651_57761022_array as $foreachloop_4f4e9064144651_57761022_key => $foreachloop_4f4e9064144651_57761022_value)
+ {
+ try
+ {
+ $foreachloop_4f4e9064144651_57761022_counter++;
+ $ste->set_var_by_name($foreachloop_4f4e9064144651_57761022_countervar, $foreachloop_4f4e9064144651_57761022_counter);
+ $ste->set_var_by_name($foreachloop_4f4e9064144651_57761022_valuevar, $foreachloop_4f4e9064144651_57761022_value);
+
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= (($ste->get_var_by_name("i")) >= ($ste->get_var_by_name("_tag_parameters[max]"))) ? 'yes' : '';
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ throw new \ste\BreakException();
+
+ }
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= "\n\t\t\t" . @$ste->vars["_tag_parameters"]["counter"];
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[] = '';
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= @$ste->vars["i"];
+ $outputstack_i--;
+ $ste->set_var_by_name(@$ste->vars["_tag_parameters"]["counter"], array_pop($outputstack));
+
+ }
+ $outputstack[$outputstack_i] .= $sub($ste);
+ }
+ catch(\ste\BreakException $e) { break; }
+ catch(\ste\ContinueException $e) { continue; }
+
+ }
+
+ return array_pop($outputstack);
+ };
+ $ste->register_tag("foreach_limit", $tag_fx);
+ return array_pop($outputstack);
+}; ?> \ No newline at end of file
diff --git a/example/templates/transc/master.html.php b/example/templates/transc/master.html.php
new file mode 100644
index 0000000..1bee843
--- /dev/null
+++ b/example/templates/transc/master.html.php
@@ -0,0 +1,503 @@
+<?php $transcompile_fx = function($ste)
+{/*Array
+(
+ [0] => ste\TextNode Object
+ (
+ [text] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en">
+<head>
+ <title>
+ [tpl] => master.html
+ [offset] => 0
+ )
+
+ [1] => ste\TagNode Object
+ (
+ [name] => if
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\VariableNode Object
+ (
+ [name] => title
+ [arrayfields] => Array
+ (
+ )
+
+ [tpl] => master.html
+ [offset] => 206
+ )
+
+ [1] => ste\TagNode Object
+ (
+ [name] => then
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\VariableNode Object
+ (
+ [name] => title
+ [arrayfields] => Array
+ (
+ )
+
+ [tpl] => master.html
+ [offset] => 222
+ )
+
+ [1] => ste\TextNode Object
+ (
+ [text] => - example
+ [tpl] => master.html
+ [offset] => 227
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 211
+ )
+
+ [2] => ste\TagNode Object
+ (
+ [name] => else
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => example
+ [tpl] => master.html
+ [offset] => 258
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 248
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 197
+ )
+
+ [2] => ste\TextNode Object
+ (
+ [text] => </title>
+ [tpl] => master.html
+ [offset] => 285
+ )
+
+ [3] => ste\TextNode Object
+ (
+ [text] => <style type="text/css">
+ * {
+ font-family: sans-serif;
+ }
+ .online {
+ color: #0a0;
+ }
+ .offline {
+ color: #555;
+ font-style: italic;
+
+ }
+ </style>
+
+</head>
+<body>
+ <h1>example</h1>
+
+ <div id="content">
+
+ [tpl] => master.html
+ [offset] => 384
+ )
+
+ [4] => ste\TagNode Object
+ (
+ [name] => block
+ [params] => Array
+ (
+ [name] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => content
+ [tpl] => master.html
+ [offset] => 626
+ )
+
+ )
+
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => Default content.
+
+ [tpl] => master.html
+ [offset] => 635
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 609
+ )
+
+ [5] => ste\TextNode Object
+ (
+ [text] => </div>
+ <div id="otherstuff">
+
+ [tpl] => master.html
+ [offset] => 670
+ )
+
+ [6] => ste\TagNode Object
+ (
+ [name] => block
+ [params] => Array
+ (
+ [name] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => otherstuff
+ [tpl] => master.html
+ [offset] => 721
+ )
+
+ )
+
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => <h2>List of users</h2>
+
+ [tpl] => master.html
+ [offset] => 733
+ )
+
+ [1] => ste\TextNode Object
+ (
+ [text] => <ul>
+
+ [tpl] => master.html
+ [offset] => 820
+ )
+
+ [2] => ste\TagNode Object
+ (
+ [name] => foreach
+ [params] => Array
+ (
+ [array] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => users
+ [tpl] => master.html
+ [offset] => 853
+ )
+
+ )
+
+ [value] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => user
+ [tpl] => master.html
+ [offset] => 867
+ )
+
+ )
+
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => <li class="
+ [tpl] => master.html
+ [offset] => 873
+ )
+
+ [1] => ste\TagNode Object
+ (
+ [name] => if
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\VariableNode Object
+ (
+ [name] => user
+ [arrayfields] => Array
+ (
+ [0] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => online
+ [tpl] => master.html
+ [offset] => 904
+ )
+
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 899
+ )
+
+ [1] => ste\TagNode Object
+ (
+ [name] => then
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => online
+ [tpl] => master.html
+ [offset] => 921
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 911
+ )
+
+ [2] => ste\TagNode Object
+ (
+ [name] => else
+ [params] => Array
+ (
+ )
+
+ [sub] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => offline
+ [tpl] => master.html
+ [offset] => 948
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 938
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 890
+ )
+
+ [2] => ste\TextNode Object
+ (
+ [text] => ">
+ [tpl] => master.html
+ [offset] => 975
+ )
+
+ [3] => ste\VariableNode Object
+ (
+ [name] => user
+ [arrayfields] => Array
+ (
+ [0] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => name
+ [tpl] => master.html
+ [offset] => 983
+ )
+
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 978
+ )
+
+ [4] => ste\TextNode Object
+ (
+ [text] => (
+ [tpl] => master.html
+ [offset] => 988
+ )
+
+ [5] => ste\VariableNode Object
+ (
+ [name] => user
+ [arrayfields] => Array
+ (
+ [0] => Array
+ (
+ [0] => ste\TextNode Object
+ (
+ [text] => username
+ [tpl] => master.html
+ [offset] => 996
+ )
+
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 991
+ )
+
+ [6] => ste\TextNode Object
+ (
+ [text] => )</li>
+
+ [tpl] => master.html
+ [offset] => 1005
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 833
+ )
+
+ [3] => ste\TextNode Object
+ (
+ [text] => </ul>
+
+ [tpl] => master.html
+ [offset] => 1030
+ )
+
+ )
+
+ [tpl] => master.html
+ [offset] => 704
+ )
+
+ [7] => ste\TextNode Object
+ (
+ [text] => </div>
+</body>
+</html>
+
+ [tpl] => master.html
+ [offset] => 1054
+ )
+
+)
+*/
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-us\" lang=\"en\">\n<head>\n\t<title>";
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= @$ste->vars["title"];
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[$outputstack_i] .= @$ste->vars["title"] . " - example";
+
+ }
+ else
+ {
+ $outputstack[$outputstack_i] .= "example";
+
+ }
+ $outputstack[$outputstack_i] .= "</title>" . "<style type=\"text/css\">\n\t\t* {\n\t\t\tfont-family: sans-serif;\n\t\t}\n\t\t.online {\n\t\t\tcolor: #0a0;\n\t\t}\n\t\t.offline {\n\t\t\tcolor: #555;\n\t\t\tfont-style: italic;\n\t\t\t\n\t\t}\n\t</style>\n\t\n</head>\n<body>\n\t<h1>example</h1>\n\t\n\t<div id=\"content\">\n\t\t";
+ $blockname_4f4e94ddd41342_39491438 = "content";
+ $ste->blocks['4f4e94ddd41470.10353359'] = array_pop($outputstack);
+ $ste->blockorder[] = '4f4e94ddd41470.10353359';
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "Default content.\n\t\t";
+ $ste->blocks[$blockname_4f4e94ddd41342_39491438] = array_pop($outputstack);
+ if(array_search($blockname_4f4e94ddd41342_39491438, $ste->blockorder) === FALSE)
+ $ste->blockorder[] = $blockname_4f4e94ddd41342_39491438;
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "</div>\n\t<div id=\"otherstuff\">\n\t\t";
+ $blockname_4f4e94ddd415e6_09352068 = "otherstuff";
+ $ste->blocks['4f4e94ddd416b2.98760934'] = array_pop($outputstack);
+ $ste->blockorder[] = '4f4e94ddd416b2.98760934';
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "<h2>List of users</h2>\n\t\t\t" . "<ul>\n\t\t\t\t";
+ $foreachloop_4f4e94ddd417b7_50245786_arrayvar = "users";
+ $foreachloop_4f4e94ddd417b7_50245786_valuevar = "user";
+ $foreachloop_4f4e94ddd417b7_50245786_array = $ste->get_var_by_name($foreachloop_4f4e94ddd417b7_50245786_arrayvar);
+ if(!is_array($foreachloop_4f4e94ddd417b7_50245786_array))
+ $foreachloop_4f4e94ddd417b7_50245786_array = array();
+ foreach($foreachloop_4f4e94ddd417b7_50245786_array as $foreachloop_4f4e94ddd417b7_50245786_key => $foreachloop_4f4e94ddd417b7_50245786_value)
+ {
+ try
+ {
+ $ste->set_var_by_name($foreachloop_4f4e94ddd417b7_50245786_valuevar, $foreachloop_4f4e94ddd417b7_50245786_value);
+
+ $outputstack[$outputstack_i] .= "<li class=\"";
+ $outputstack[] = "";
+ $outputstack_i++;
+ $outputstack[$outputstack_i] .= @$ste->vars["user"]["online"];
+ $outputstack_i--;
+ if($ste->evalbool(array_pop($outputstack)))
+ {
+ $outputstack[$outputstack_i] .= "online";
+
+ }
+ else
+ {
+ $outputstack[$outputstack_i] .= "offline";
+
+ }
+ $outputstack[$outputstack_i] .= "\">" . @$ste->vars["user"]["name"] . " (" . @$ste->vars["user"]["username"] . ")</li>\n\t\t\t\t";
+
+ }
+ catch(\ste\BreakException $e) { break; }
+ catch(\ste\ContinueException $e) { continue; }
+
+ }
+
+ $outputstack[$outputstack_i] .= "</ul>\n\t\t";
+ $ste->blocks[$blockname_4f4e94ddd415e6_09352068] = array_pop($outputstack);
+ if(array_search($blockname_4f4e94ddd415e6_09352068, $ste->blockorder) === FALSE)
+ $ste->blockorder[] = $blockname_4f4e94ddd415e6_09352068;
+ $outputstack = array('');
+ $outputstack_i = 0;
+ $outputstack[$outputstack_i] .= "</div>\n</body>\n</html>\n";
+ return array_pop($outputstack);
+}; ?> \ No newline at end of file
diff --git a/stupid_template_engine.php b/stupid_template_engine.php
index 6acb6d7..e8e78ec 100644
--- a/stupid_template_engine.php
+++ b/stupid_template_engine.php
@@ -1396,6 +1396,44 @@ class STEStandardLibrary
{
return @strftime($sub($ste), empty($params["timestamp"]) ? @time() : (int) $params["timestamp"]);
}
+
+ static public function in_array($ste, $params, $sub)
+ {
+ if(empty($params["array"]))
+ throw new RuntimeError("Missing array parameter in <ste:in_array>.");
+ $ar = &$ste->get_var_reference($params["array"], False);
+ if(!is_array($ar))
+ return "";
+ return in_array($sub($ste), $ar) ? "y" : "";
+ }
+
+ static public function join($ste, $params, $sub)
+ {
+ if(empty($params["array"]))
+ throw new RuntimeError("Missing array parameter in <ste:join>.");
+ return implode($sub($ste), $ste->get_var_by_name($params["array"]));
+ }
+
+ static public function split($ste, $params, $sub)
+ {
+ if(empty($params["array"]))
+ throw new RuntimeError("Missing array parameter in <ste:split>.");
+ if(empty($params["delim"]))
+ throw new RuntimeError("Missing delim parameter in <ste:split>.");
+ $ste->set_var_by_name($params["array"], explode($params["delim"], $sub($ste)));
+ }
+
+ static public function array_add($ste, $params, $sub)
+ {
+ if(empty($params["array"]))
+ throw new RuntimeError("Missing array parameter in <ste:array_add>.");
+
+ $ar = &$ste->get_var_reference($params["array"], True);
+ if(empty($params["key"]))
+ $ar[] = $sub($ste);
+ else
+ $ar[$params["key"]] = $sub($ste);
+ }
}
?> \ No newline at end of file