changed init to be used to set complete template data, has to be as array in $name

This commit is contained in:
Ralf Becker 2002-06-09 21:31:01 +00:00
parent ca58fb532e
commit 2ac9898a76

View File

@ -107,14 +107,14 @@
/*! /*!
@function init @function init
@abstract initialises all internal data-structures of the eTemplate and sets the keys @abstract initialises all internal data-structures of the eTemplate and sets the keys
@param $name name of the eTemplate or array with the keys @param $name name of the eTemplate or array with the keys or all data
@param $template,$lang,$group,$version see class @param $template,$lang,$group,$version see class
@param $rows,$cols initial size of the template @param $rows,$cols initial size of the template
*/ */
function init($name='',$template='',$lang='',$group=0,$version='',$rows=1,$cols=1) function init($name='',$template='',$lang='',$group=0,$version='',$rows=1,$cols=1)
{ {
reset($this->db_key_cols); reset($this->db_cols);
while (list($db_col,$col) = each($this->db_key_cols)) while (list($db_col,$col) = each($this->db_cols))
{ {
$this->$col = is_array($name) ? $name[$col] : $$col; $this->$col = is_array($name) ? $name[$col] : $$col;
} }
@ -126,6 +126,10 @@
{ {
$this->lang = ''; $this->lang = '';
} }
if (is_array($name) && isset($name['data']))
{
return; // data already set
}
$this->size = $this->style = ''; $this->size = $this->style = '';
$this->data = array(); $this->data = array();
$this->rows = $rows < 0 ? 1 : $rows; $this->rows = $rows < 0 ? 1 : $rows;