In your PHP: *$imgAttr = ''; foreach($attributes as $attrname => $attrvalue) $imgAttr .= "$attrname $attrvalue;";
$templateObject->imgAttr = $imgAttr;* In your template: *<img tal:attributes="${imgAttr}" />* Hope this may help. Anton Andryevskyy On Jan 29, 2008 12:30 AM, Werner <[EMAIL PROTECTED]> wrote: > Hi! > > Has anyone found an easy (and readable) way to do the following by using > tal:attributes ? > > 1) You have an $attributes array in php: > $attributes = array('id' => 'some_id', 'class' => 'some_class', > 'src' => 'img/beautiful.jpg'); > > 2) You want to apply all the attributes as an element's attributes: > <img id="some_id" class="some_class" src="img/beautiful.jpg"/> > > Kind Regards, > Werner > > > _______________________________________________ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal >
_______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal