|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bhadsock Smarty n00b
Joined: 06 Oct 2003 Posts: 1
|
Posted: Mon Oct 06, 2003 3:42 pm Post subject: Newbie Prefilter Problems |
|
|
I am new to Smarty and just installed it on my server and it seems to be working properly. Now, I am trying to use a prefilter for my templates, but I can not get ANY prefilter to work. I made a prefilter to just add a comment to the template called prefilter.test.php and placed it in the plugins directory that is shown below:
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: prefilter
* Name: test
* Purpose:
* Example:
* Author:
* Version: 1.0
* Date: 10/03/03
* -------------------------------------------------------------
*/
function smarty_prefilter_test($source, &$smarty)
{
return '<!-- Test -->'."\n\n".$source;
}
?>
I then call then load the prefilter using load_prefilter as shown in my test php application:
<?php
//-- Configure smarty template engine
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/www/smarty/test/templates/';
$smarty->compile_dir = '/www/smarty/test/templates_c/';
$smarty->config_dir = '/www/smarty/test/configs/';
$smarty->cache_dir = '/www/smarty/test/cache/';
$smarty->load_filter('pre','test');
$smarty->display('test.tpl');
?>
I do not get any errors from Smarty and I have also tried specifying the plugin directory, but the comment never shows up in the file.
Any help would greatly be appreciated.
Thanks, |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Oct 06, 2003 5:53 pm Post subject: |
|
|
prefilters are only applied when the template is compiled. to test the prefilter you should turn $smarty->force_compile to true. |
|
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
|