[PHPTAL] Creating easy-to-write attribute values

Werner lists at mollentze.co.za
Wed Jan 24 14:11:26 CET 2007


Hi,

Here follows some sample template markup that illustrates a very common 
templating task:

...
<img tal:attributes="src string:$myImgBaseUrl/pic.png" alt="My Pic With 
A Difficult-To-Write Base Url"/>
...

Yet, I cannot find a way to make it more efficient and (obviously) 
easier to mark-up for template designers. Can anyone help me find a way 
to make it simpler, say, to achieve something like this...

...
<img tal:attributes="src myImgBaseUrl/pic.png" alt="My Pic With An 
Easier-To-Write Base Url"/>
...

The above would easily work with a predefined object passed from PHP (so 
that PHPTAL can resolve the 'object path'), but keep in mind that only 
the template designers know the location (and filenames) of the page's 
images. The designer only knows that he/she would like to put "pic.png" 
in there, and I don't want to make it difficult for them to attach a 
shared image base url path to the image's markup, since only the 
developers know the base url of the public image paths.

Any groovy ideas?

Kind Regards,
Werner



More information about the PHPTAL mailing list