cvs: smarty / NEWS /libs Smarty.class.php /libs/plugins core.parse_file_path.php

From: Date: Fri, 06 Jun 2003 15:49:29 +0000
Subject: cvs: smarty / NEWS /libs Smarty.class.php /libs/plugins core.parse_file_path.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-627@lists.php.net to get a copy of this message
mohrt Fri Jun 6 11:49:29 2003 EDT Modified files: /smarty NEWS /smarty/libs Smarty.class.php /smarty/libs/plugins core.parse_file_path.php Log: add default_resource_type, ignore 1 char resource names Index: smarty/NEWS diff -u smarty/NEWS:1.369 smarty/NEWS:1.370 --- smarty/NEWS:1.369 Fri Jun 6 09:52:21 2003 +++ smarty/NEWS Fri Jun 6 11:49:29 2003 @@ -1,3 +1,5 @@ + - ignore one char resource names like c:foo.tpl (Monte) + - added default_resource_type feature (Monte) - fix bug where config file starts with hidden section (boots, Monte) - add discrete error checking pertaining to $cache_dir and $compile_dir, their existance and writability (Monte) Index: smarty/libs/Smarty.class.php diff -u smarty/libs/Smarty.class.php:1.398 smarty/libs/Smarty.class.php:1.399 --- smarty/libs/Smarty.class.php:1.398 Wed Jun 4 09:50:50 2003 +++ smarty/libs/Smarty.class.php Fri Jun 6 11:49:29 2003 @@ -42,7 +42,7 @@ * @version 2.5.0 */ -/* $Id: Smarty.class.php,v 1.398 2003/06/04 13:50:50 mohrt Exp $ */ +/* $Id: Smarty.class.php,v 1.399 2003/06/06 15:49:29 mohrt Exp $ */ /** * DIR_SEP isn't used anymore, but third party apps might @@ -300,6 +300,20 @@ */ var $default_modifiers = array(); + /** + * This is the resource type to be used when not specified + * at the beginning of the resource path. examples: + * $smarty->display('file:index.tpl'); + * $smarty->display('db:index.tpl'); + * $smarty->display('index.tpl'); // will use default resource type + * {include file="file:index.tpl"} + * {include file="db:index.tpl"} + * {include file="index.tpl"} {* will use default resource type *} + * + * @var array + */ + var $default_resource_type = 'file'; + /** * The function used for cache file handling. If not set, built-in caching is used. * Index: smarty/libs/plugins/core.parse_file_path.php diff -u smarty/libs/plugins/core.parse_file_path.php:1.1 smarty/libs/plugins/core.parse_file_path.php:1.2 --- smarty/libs/plugins/core.parse_file_path.php:1.1 Thu May 8 16:21:16 2003 +++ smarty/libs/plugins/core.parse_file_path.php Fri Jun 6 11:49:29 2003 @@ -25,11 +25,17 @@ if (count($_file_path_parts) == 1) { // no resource type, treat as type "file" - $params['resource_type'] = 'file'; + $params['resource_type'] = $this->default_resource_type; $params['resource_name'] = $_file_path_parts[0]; } else { - $params['resource_type'] = $_file_path_parts[0]; - $params['resource_name'] = $_file_path_parts[1]; + if(strlen($_file_path_parts[0]) == 1) { + // 1 char is not resource type, but part of filepath + $params['resource_type'] = $this->default_resource_type; + $params['resource_name'] = $params['file_path']; + } else { + $params['resource_type'] = $_file_path_parts[0]; + $params['resource_name'] = $_file_path_parts[1]; + } if ($params['resource_type'] != 'file') { $_params = array('type' => $params['resource_type']); $this->_execute_core_function('load_resource_plugin', $_params);

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