mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- config_load method can now be called on data and template objects
This commit is contained in:
4
README
4
README
@@ -250,6 +250,7 @@ global variables.
|
|||||||
A Smarty data object can be created as follows:
|
A Smarty data object can be created as follows:
|
||||||
$data = new Smarty_Data; // create root data object
|
$data = new Smarty_Data; // create root data object
|
||||||
$data->assign('foo','bar'); // assign variables as usual
|
$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
|
$data= new Smarty_Data($smarty); // create data object having a parent link to
|
||||||
the Smarty object
|
the Smarty object
|
||||||
@@ -266,7 +267,8 @@ The first parameter can be a template name, a smarty object or a data object.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent
|
$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',$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
|
$tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
11/05/2009
|
||||||
|
- config_load method can now be called on data and template objects
|
||||||
|
|
||||||
11/04/2009
|
11/04/2009
|
||||||
- added typecasting support for template variables
|
- added typecasting support for template variables
|
||||||
- bugfix on complex indexed special Smarty variables
|
- bugfix on complex indexed special Smarty variables
|
||||||
|
@@ -200,6 +200,19 @@ class Smarty_Internal_TemplateBase {
|
|||||||
$this->tpl_vars = array();
|
$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
|
* gets the object of a Smarty variable
|
||||||
*
|
*
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty methode Config_Load
|
|
||||||
*
|
|
||||||
* Loads a config file
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage Config
|
|
||||||
* @author Uwe Tews
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* load a config file optionally load just selected sections
|
|
||||||
*
|
|
||||||
* @param object $smarty
|
|
||||||
* @param string $config_file filename
|
|
||||||
* @param mixed $sections array of section names, single section or null
|
|
||||||
*/
|
|
||||||
function Smarty_Method_Config_Load($smarty, $config_file, $sections = null)
|
|
||||||
{
|
|
||||||
// load Config class
|
|
||||||
$config = new Smarty_Internal_Config($config_file, $smarty);
|
|
||||||
$config->loadConfigVars($sections, $smarty);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
Reference in New Issue
Block a user