Re: [SMARTY] Smarty templates syntax validation

Marcus Bointon <[email protected]> Sat, 23 Sep 2006 22:49:33 +0100
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
On 19 Sep 2006, at 17:32, Ɓukasz 'nostra' Wojciechowski wrote:

> I'm using Smarty for a long time now for web templates. Now I started
> using it for compiling e-mail templates. Now I want to give access to
> user to change e-mail templates. And here comes the problem. I want to
> validate template syntax before allowing its change. It's quite with
> file: resource (e.g. $smarty->fetch("file:some.file.tpl"); but can't
> make it working with database resource. I tried to make it working  
> with
> SmartyCompiler->_compile_file but it appears that it doesn't recognize
> resource tag (e.g. "db:some.name");

I have exactly the same problem! It's especially bad in that many of  
these errors are fatal. The only method I've thought of so far is to  
fire up a CLI instance of PHP using exec() try using the template and  
see if it works, but I don't have a tidy method for doing that as yet.
At present I'm avoiding the problem using my own very restricted  
template syntax - anything even slightly weird just gets ignored. It  
works, but it's very limiting - it would be much nicer to use smarty.

So, if anyone comes up with a neat mechanism, I'd like to hear about  
it too.

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Creators of http://www.smartmessages.net/
[email protected] | http://www.synchromedia.co.uk/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php