Re: [SMARTY] how to use smarty ?
| From: | Pupeno | Date: | Tue, 11 Jun 2002 17:20:50 +0000 |
| Subject: | Re: [SMARTY] how to use smarty ? | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4785@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 11 June 2002 01:12, Pupeno wrote:
> I'll try not to anser myself again...
> I think that this would help me in my framework... if I add another
> parameter to the include function, a boolean parameter, in case it's true
> (false by default), the included file will be parsed just from one tag to
> another (let's say {start} and {stop} or something like that), if I code
> this, are you intrested into this ?
> Thank you.
I just said that I'll try...
Well, I did it, I implemented, but there's no other parameter in the include
function, just, when there are start and end tags, everything else is cleaned
away. This is done at the begining of the compile function, just this:
// if there are start and end tags, clean everything else
if(preg_match_all("/{$ldq}start{$rdq}.*{$ldq}end{$rdq}/s", $template_source,
$matches)){
$template_source = preg_replace("/.+{$ldq}start{$rdq}(.*){$ldq}end{$rdq}.+/s",
"\\1", $template_source);
} else if(preg_match_all("/{$ldq}(start|end){$rdq}/s", $template_source,
$matches)){
$this->_syntax_error("The start/end tag pair is not complete");
}
I know this may look like a horrible hack, well, it is, if you tell me a bit
more about your standards and where I should write this I'll do it, and if
you want I can do it in the cvs code and send you patch.
Thanks!
- --
Pupeno: pupeno@pupeno.com
http://www.pupeno.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9BjF0Lr8z5XzmSDQRApKYAJ4tj7+4x5S15FtFcDoCK4OM9uSqUgCfXFJN
ABz9Qx0eZsIX9Ynogl9C08k=
=W+ci
-----END PGP SIGNATURE-----