[PHPTAL] setPreFilter dosen't work?

Levi Stanley levi at eneservices.com
Mon May 14 16:26:10 CEST 2007


Mynthon:

Actually setPreFilter does work, however, it only works if you don't
already have pre-generated code in your CodePath for that file. 
PreFilter only runs if there has been an update in the code, or there
isn't already intermediate code generated, so just clear out your
generated code in your tmp, or
/usr/local/www/www4.stat.pl/!lab/php-tal/, and then run the script you
will see your test filters printing.

Best regards,
Levi

Mynthon wrote:
> 1st thing: i don't know why but  'PHPTAL/Filter.php' isn't included by
> default. Is it necessary to set up phptal dir if i have right include
> path in my php.ini?
>
> 2nd. can't use setPreFilter. Code:
>
>
> class MyPostFilter implements PHPTAL_Filter {
>    public function filter($xhtml){
>        echo 'test';
>        return $xhtml;
>    }
> }
>
> $template->setPostFilter(new MyPostFilter());
> echo $template->execute();
>
> works ok. but:
>
> class MyPreFilter implements PHPTAL_Filter {
>    public function filter($source){
>      echo 'test';
>      return $source;
>    }
> }
>
> $template->setPreFilter(new MyPreFilter());
> echo $template->execute();
>
> doesn't work. Ive also tried:
>
> public function filter($source){
>      exit();
> }
>
> and
>
> public function filter($source){
>      return '';
> }
>
> and
>
> public function filter($source){
>      return 'test';
> }
>
> but it does not work (i always get template file generated properly).
> Any ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/phptal/attachments/20070514/3e937d09/attachment.htm


More information about the PHPTAL mailing list