new snapshot - default template handler

From: Date: Wed, 12 Dec 2001 21:08:56 +0000
Subject: new snapshot - default template handler
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2269@lists.php.net to get a copy of this message
The default template handler works like the following: * Smarty reads the template file * If that fails, it uses the default template handler function to read the template * If that fails, Smarty displays an error see _fetch_template_info for details. as far as security is concerned, the template is checked for security _after_ it is loaded, in the case the file is not yet findable. the template handling function works like the following: // how smarty calls it: $_return = $funcname($tpl_path, $template_source, $template_timestamp, $this); function make_tpl ($tpl_path, &$template_source, &$template_timestamp, $smarty_obj) { // get the filepath to the template $smarty_obj->_parse_file_path($smarty_obj->template_dir, $tpl_path, $resource_type, $resource_name); // fake up some template content $template_source = 'bar'; // write the file if($smarty_obj->_write_file($resource_name,$template_source)) { $template_timestamp = time(); return true; } // write didn't work $template_source = null; return false; } The example function creates the template, sets the source/timestamp vars and returns true on success. question is, should the function take tpl_path as one argument, or resource_type and resource_name as separate arguments, already parsed with _parse_file_path? Monte

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