Hi everyone,

it would be great if you could pass an array containing all template variables 
to the set() method, so that I could write:

$template = new PHPTAL($this->_viewDir . DS . $fileName);
$template->set($this->_viewVars);

instead of:

$template = new PHPTAL($this->_viewDir . DS . $fileName);
foreach ($this->_viewVars as $key => $value) {
        $template->set($key, $value);
}



proposed set() function for class PHPTAL:

public function set($var, $value = NULL)
{
        if(is_array($var)) {
                foreach ($var as $key=>$val) {
                        $this->_context->__set($key, $val);
                }
        }
        else {
                $this->_context->__set($var, $value);
        }
        return $this;
}


Regards,
Moritz


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to