 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
monsieurcanard Smarty Rookie
Joined: 12 May 2005 Posts: 5
|
Posted: Tue May 31, 2005 3:07 pm Post subject: Smarty isn't using my own custom postfilter |
|
|
Hi,
I've written a postfilter:
| Code: | <?php
function smarty_postfilter_add_session_id($compiled, &$smarty){
//preg_replace code here
// test the postfilter
$compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
return $compiled;
}
?> |
...called postfilter.add_session_id.php. I've added to the libs/plugins directory, and called:
| Code: | | $smarty->autoload_filters = array("post" => array("add_session_id") ); |
...from my index.php file. It seems as though Smarty isn't registering my postfilter.
Can anyone suggest a fix?
Many thanks,
Matt  |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7047 Location: Lincoln Nebraska, USA
|
Posted: Tue May 31, 2005 3:18 pm Post subject: |
|
|
| I tested your example and it worked for me (?) Maybe you have caching on, or your template is not getting recompiled. Try clearing all your compiled templates, or maybe try force_compile enabled (just to test) |
|
| Back to top |
|
monsieurcanard Smarty Rookie
Joined: 12 May 2005 Posts: 5
|
Posted: Tue May 31, 2005 3:25 pm Post subject: |
|
|
Thank you! Clearing out my templates_c directory fixed it
Thanks again,
Matt  |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|