What happened to _compile_string()?

From: Date: Fri, 28 Nov 2003 13:32:07 +0000
Subject: What happened to _compile_string()?
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1943@lists.php.net to get a copy of this message
Something that I do a lot of is create smarty interpreted strings on the fly, e.g. for the subject of an email, rather than anything coming from a file. To date I've been using a superclass of Smarty that adds a function to compile a template from a string. It broke when I upgraded to 2.6. Internally it calls _compile_string(), which seems to not exist any more (serves me right for using a private function ??!), so I needed to know what the equivalent is now. I took a guess at _compile_source and that does seem to work. My function is now: function compile_string_template($templatestring) { if (!isset($templatestring)) { $this->trigger_error("compile_string_template: missing 'templatestring' parameter"); return; } if($templatestring == '') { return ""; } $this->_compile_source("string template", $templatestring, $source); //Dump compiled version in output buffer ob_start(); eval('?>' . $source); $evaled = ob_get_contents(); ob_end_clean(); return $evaled; } I thought that since many others may be doing something similar, this would be useful for the list. Is it time to request this again as a standard Smarty feature? Or have I missed something else in 2.6? Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

« previous php.smarty.dev (#1943) next »