Re: template engine
| From: | Andrei BEJENARU | Date: | Thu, 19 Jun 2003 14:38:29 +0000 |
| Subject: | Re: template engine | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152167@lists.php.net to get a copy of this message | ||
You must use
$template = preg_replace("!{for loops=(.*)}(.*){/for}!U",
code('\\1','\\2'),
$template);
since the references are of the form \\n
Andrei BEJENARU
"Niels Uhlendorf" <yushu@offucia.org> wrote in message
news:20030619142149.72856.qmail@pb1.pair.com...
> Hi,
>
> Since I don't want to continue with Smarty I started with an own
> (little) template engine. In this first try it should only replace
> {for loops=INTEGER} ... {/for} through a trivial FOR-loop which runs
> INTEGER times.
>
> This mission was sent to the function "loop" in this file:
>
> http://www.offucia.org/pages/template-engine/source.php?file=engine.php
>
> In this file I try to work with it
>
> http://www.offucia.org/pages/template-engine/source.php?file=test.php
>
> But the file loop() cannot be found and theres this mistake error:
> Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or
> '$' in /www/htdocs/v035923/pages/template-engine/engine.php on line 26
>
> Line 26 is this one:
> $template = preg_replace("!{for loops=(.*)} (.*)
> {/for}!U",code($1,$2),$template);
>
>
>
> Many thx 4 help
> Niels Uhlendorf
>