Aquileo | Recent changes to feature-requestshttps://sourceforge.net/p/php-templates/feature-requests/2003-06-05T15:43:16ZRecent changes to feature-requestsAquileo | Native OO Interface.2003-06-05T15:43:16Z2003-06-05T15:43:16ZSjonhttps://sourceforge.net/u/sjondamon/https://sourceforge.net9fcd42ea1412143d57e53a0939df1285219a423b<div class="markdown_content"><p>Another thing I'd like to see is a native oo interface<br />
for this extension. I've attached an php code example<br />
of how such an interface would look (The extensions in<br />
there can be disregarded).</p>
<p>eg:<br />
&lt;?php</p>
<p>$t = new tmpl();<br />
$t-&gt;open('test.tpl');<br />
$t-&gt;set_global('random', mt_rand());<br />
for ($i = 0; $i &lt; 4; $i++) {<br />
$t-&gt;iterate('/row');<br />
$t-&gt;set('/row', array('one' =&gt; '1', 'two' =&gt; '2'));<br />
}<br />
echo $t-&gt;parse();</p>
<p>?&gt;</p>
<p>Regards, Sjon</p></div>Aquileo | Ability to register callback functions.2003-05-20T08:32:13Z2003-05-20T08:32:13ZSjonhttps://sourceforge.net/u/sjondamon/https://sourceforge.net790ede2f3b35490d878a129ab6d45cd434269c87<div class="markdown_content"><p>Hi.</p>
<p>I've made my own templating function library in php (who <br />
hasn't), and added besides the standard replacement <br />
stuff also a way to incorporate so called tags inside <br />
templates, wich can be assigned a handler.<br />
Example:<br />
// the tag wich can be put inside a template<br />
&lt;tag:random min=&quot;100&quot; max=&quot;999&quot; /&gt;</p>
<p>// registering a handler with a tag<br />
stpl_register_tag<br />
(STPL_FETCH_EVENT, 'random', 'stpl_tag_random');</p>
<p>// example function<br />
function stpl_tag_random ($params) {<br />
$min = (isset($params['min']) ? $params['min'] : 0);<br />
$max = (isset($params['max']) ? $params['max'] : <br />
mt_getrandmax());<br />
return mt_rand($min, $max);<br />
}</p>
<p>the STPL_FETCH_EVENT is one of three events that <br />
occur. In order:<br />
STPL_LOAD_EVENT: when the template get's read <br />
from disk<br />
STPL_PARSE_EVENT: when the template get's parsed <br />
(variable substitution)<br />
STPL_FETCH_EVENT: when the parsed content get's <br />
fetched for display/storage</p>
<p>Now, I know the event stuff may not really make sense <br />
with this extension (maybe the first two do), but I would <br />
love to see something like this incorporated into this <br />
extension.<br />
I'm no C programmer, so I can't be of much use in that <br />
field, but I would love to help. I think one additional <br />
function and two ini entries (tag_start and tag_end) <br />
would be all that's needed. Maybe even add a few <br />
predefined tag handlers (like above random, date, <br />
include), etc.</p>
<p>If you've got any questions, let me know.</p>
<p>Regards, Sjon.</p></div>Aquileo | replacing multiple tokens2002-03-11T13:18:12Z2002-03-11T13:18:12ZClementhttps://sourceforge.net/u/iclem/https://sourceforge.netb0002a5ca21646d8b5e23fb1eea17bd04cd1ad08<div class="markdown_content"><p>Could it be possible to replace all of the occurences<br />
of a same token in a context with only one assign?<br />
ex:<br />
&lt;pre&gt;<br />
&lt;tmpl:blah&gt;</p>
<p>&lt;a href=&quot;index.php?do=erase&amp;id={ID}&quot;&gt;<br />
&lt;a href=&quot;index.php?do=modify&amp;id={ID}&quot;&gt;</p>
<p>&lt;/tmpl:blah&gt;<br />
&lt;/pre&gt;</p>
<p>Thanks</p></div>