cvs: smarty / NEWS Smarty.class.php

From: Date: Wed, 03 Apr 2002 19:31:12 +0000
Subject: cvs: smarty / NEWS Smarty.class.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-9@lists.php.net to get a copy of this message
andrei Wed Apr 3 14:31:12 2002 EDT Modified files: /smarty NEWS Smarty.class.php Log: Added template_exists() API. Index: smarty/NEWS diff -u smarty/NEWS:1.182 smarty/NEWS:1.183 --- smarty/NEWS:1.182 Wed Apr 3 11:31:58 2002 +++ smarty/NEWS Wed Apr 3 14:31:10 2002 @@ -1,3 +1,4 @@ + - added template_exists() API function. (Andrei) - fixed a problem with using dynamic values for 'file' attribute of {include_php} tag. (Andrei) - added $smarty.template variable. (Andrei) Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.259 smarty/Smarty.class.php:1.260 --- smarty/Smarty.class.php:1.259 Wed Apr 3 11:31:59 2002 +++ smarty/Smarty.class.php Wed Apr 3 14:31:11 2002 @@ -469,6 +469,11 @@ return $this->_rm_auto($this->compile_dir, $tpl_file, $compile_id); } + function template_exists($tpl_file) + { + return $this->_fetch_template_info($tpl_file, $source, $timestamp, true, true); + } + /*======================================================================*\ Function: get_template_vars Purpose: Returns an array containing template variables @@ -881,7 +886,7 @@ Purpose: fetch the template info. Gets timestamp, and source if get_source is true \*======================================================================*/ - function _fetch_template_info($tpl_path, &$template_source, &$template_timestamp, $get_source = true) + function _fetch_template_info($tpl_path, &$template_source, &$template_timestamp, $get_source = true, $quiet = false) { $_return = false; if ($this->_parse_file_path($this->template_dir, $tpl_path, $resource_type, $resource_name)) { @@ -924,9 +929,11 @@ } if (!$_return) { - $this->trigger_error("unable to read template resource: \"$tpl_path\""); + if (!$quiet) + $this->trigger_error("unable to read template resource: \"$tpl_path\""); } else if ($_return && $this->security && !$this->_is_secure($resource_type, $resource_name)) { - $this->trigger_error("(secure mode) accessing \"$tpl_path\" is not allowed"); + if (!$quiet) + $this->trigger_error("(secure mode) accessing \"$tpl_path\" is not allowed"); $template_source = null; $template_timestamp = null; return false;

« previous php.smarty.cvs (#9) next »