-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
On 11/22/2010 11:27 AM, Moritz Baumann wrote:
> 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);

Another thing that IMHO should be considered is that PHPTAL should
implement ArrayAccess so you could do
$template['menu'] = $menu;

Would a patch for this be accepted?
Regards,
Tarjei
> 
> 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


- -- 
Tarjei Huse
Mobil: 920 63 413
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzqT/YACgkQYVRKCnSvzfJx7QCglq+1L/IlErs/8BrSPA/b1Urk
mU4AnRA/SEnr5roB6Nm0aSP3ioZq1UQV
=2uIQ
-----END PGP SIGNATURE-----

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

Reply via email to