mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
add get_config_vars() method, update get_template_vars() functionality
This commit is contained in:
4
NEWS
4
NEWS
@@ -1,3 +1,7 @@
|
||||
- added get_config_vars(), same basic functionality as
|
||||
get_template_vars() (Monte)
|
||||
- update get_template_vars() to be able to get
|
||||
individual vars (Monte)
|
||||
- fix minor logic in _fetch_template_info (Dennis Gearon,
|
||||
Monte)
|
||||
- fix cache groups with compile_id set (Monte)
|
||||
|
@@ -1001,13 +1001,35 @@ class Smarty
|
||||
/**
|
||||
* Returns an array containing template variables
|
||||
*
|
||||
* @return array
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
function &get_template_vars()
|
||||
function &get_template_vars($name=null)
|
||||
{
|
||||
return $this->_tpl_vars;
|
||||
if(!isset($name)) {
|
||||
return $this->_tpl_vars;
|
||||
}
|
||||
if(isset($this->_tpl_vars[$name])) {
|
||||
return $this->_tpl_vars[$name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing config variables
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
function &get_config_vars($name=null)
|
||||
{
|
||||
if(!isset($name) && is_array($this->_config[0])) {
|
||||
return $this->_config[0]['vars'];
|
||||
} else if(isset($this->_config[0]['vars'][$name])) {
|
||||
return $this->_config[0]['vars'][$name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* trigger Smarty error
|
||||
|
@@ -1001,13 +1001,35 @@ class Smarty
|
||||
/**
|
||||
* Returns an array containing template variables
|
||||
*
|
||||
* @return array
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
function &get_template_vars()
|
||||
function &get_template_vars($name=null)
|
||||
{
|
||||
return $this->_tpl_vars;
|
||||
if(!isset($name)) {
|
||||
return $this->_tpl_vars;
|
||||
}
|
||||
if(isset($this->_tpl_vars[$name])) {
|
||||
return $this->_tpl_vars[$name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing config variables
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
function &get_config_vars($name=null)
|
||||
{
|
||||
if(!isset($name) && is_array($this->_config[0])) {
|
||||
return $this->_config[0]['vars'];
|
||||
} else if(isset($this->_config[0]['vars'][$name])) {
|
||||
return $this->_config[0]['vars'][$name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* trigger Smarty error
|
||||
|
Reference in New Issue
Block a user