add get_config_vars() method, update get_template_vars() functionality

This commit is contained in:
mohrt
2003-02-20 21:59:09 +00:00
parent 5307693b78
commit 9bcd117ecd
3 changed files with 54 additions and 6 deletions

4
NEWS
View File

@@ -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)

View File

@@ -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

View File

@@ -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