Hi, This is because php doesn't support __set() in array context, which is what phptal uses to define template variables.
It's a bit of a drawback to having to construct a temporary array first every time, but with php5 it doesn't incur much penalty since it uses copy-on-write by default ;-) On 8/26/09, GRolf <ger...@pictureparking.com> wrote: > > > I created a class which extends phptal, so this class can handle a > couple of common tasks (eg adding javascript includes) > > > it seems that assigning variables to an array, one by one, doesn't > work? the values are set, but are not available in the template. > > Let me clarify, if needed: > > $this->myarray[] = 'val1'; > $this->myarray[] = 'val2'; > > doesn't work, whereas > > $this->myarray = array('val1', 'val2'); > > works fine. Also > > $this->myarray_temp[] = 'val1'; > $this->myarray_temp[] = 'val2'; > $this->myarray = $this->myarray_temp; > > works fine. > > > > Is this known (and wanted?) behaviour ? > > > > > _______________________________________________ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal > -- -- Tjerk _______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal