Re: [SMARTY] Smarty templates syntax validation
| From: | Marcus Bointon | Date: | Sat, 23 Sep 2006 21:49:33 +0000 |
| Subject: | Re: [SMARTY] Smarty templates syntax validation | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13487@lists.php.net to get a copy of this message | ||
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/ marcus@synchromedia.co.uk | http://www.synchromedia.co.uk/