RE: [SMARTY] determining syntactically valid templates

From: Date: Mon, 06 Nov 2006 01:32:02 +0000
Subject: RE: [SMARTY] determining syntactically valid templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13557@lists.php.net to get a copy of this message
> From: Travis Low > Hello. Is there a function available, or can anyone think of > a good trick to determine if a template is syntactically > valid, without having to render it? > > I'd like to provide my clients a means to do simple template > edits. But before saving the template, I'd like to be able > to pass the template as a string to some function (or pass > the filename/path to a function) and have the function return > TRUE if the template is syntactically valid, FALSE otherwise. Probably the easiest method would be an iframe. Take the user's edited template, save it as a temp file, use an iframe to make a separate call to the server to get a rendered version, to be displayed via the iframe. Give the user a method on the containing page to accept/revise their edited content. If accepted, issue a request (either via regular post or via in background with an ajax request) to move the temp file to its permanent home. Obviously if the edited template results in a fatal parse error or something, the user will not "accept" the edit. Iframes are generally irritating, but this is one case where it might be worthwhile to 'em. -- Max Schwanekamp NeptuneWebworks.com

« previous php.smarty.general (#13557) next »