Afficher un message
Vieux 23/09/2006, 22h49   #7
Marcus Bointon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Smarty templates syntax validation


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/
  Réponse avec citation
 
Page generated in 0,05631 seconds with 9 queries