diff --git a/README b/README index 5f9d3310..7b725e8a 100644 --- a/README +++ b/README @@ -250,6 +250,7 @@ global variables. A Smarty data object can be created as follows: $data = new Smarty_Data; // create root data object $data->assign('foo','bar'); // assign variables as usual +$data->conf_load('my.conf'); // load config file $data= new Smarty_Data($smarty); // create data object having a parent link to the Smarty object @@ -266,7 +267,8 @@ The first parameter can be a template name, a smarty object or a data object. Examples: $tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent -$tpl->assign('foo','bar'); // directly assign variables +$tpl->assign('foo','bar'); // directly assign variables +$tpl->conf_load('my.conf'); // load config file $tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object $tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object diff --git a/change_log.txt b/change_log.txt index badf6470..1e565267 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +11/05/2009 +- config_load method can now be called on data and template objects + 11/04/2009 - added typecasting support for template variables - bugfix on complex indexed special Smarty variables diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index 768e158a..0085b558 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -200,6 +200,19 @@ class Smarty_Internal_TemplateBase { $this->tpl_vars = array(); } + /** + * load a config file, optionally load just selected sections + * + * @param string $config_file filename + * @param mixed $sections array of section names, single section or null + */ + public function config_load($config_file, $sections = null) + { + // load Config class + $config = new Smarty_Internal_Config($config_file, $this->smarty); + $config->loadConfigVars($sections, $this); + } + /** * gets the object of a Smarty variable * diff --git a/libs/sysplugins/smarty_method_config_load.php b/libs/sysplugins/smarty_method_config_load.php deleted file mode 100644 index bea6e741..00000000 --- a/libs/sysplugins/smarty_method_config_load.php +++ /dev/null @@ -1,27 +0,0 @@ -loadConfigVars($sections, $smarty); -} - -?>