[PHPTAL] Imploding tal:attributesfrom source array

Werner lists at mollentze.co.za
Mon Jan 28 23:30:58 CET 2008


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




More information about the PHPTAL mailing list