Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Newbie Prefilter Problems

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
bhadsock
Smarty n00b


Joined: 06 Oct 2003
Posts: 1

PostPosted: Mon Oct 06, 2003 3:42 pm    Post subject: Newbie Prefilter Problems Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Oct 06, 2003 5:53 pm    Post subject: Reply with quote

prefilters are only applied when the template is compiled. to test the prefilter you should turn $smarty->force_compile to true.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP