[Zope] Embedding absolute_url in TAL Syntax

Mike Renfro renfro@tntech.edu
Thu, 6 Jun 2002 14:53:48 -0500


On Thu, Jun 06, 2002 at 12:48:10PM -0700, Dan Shafer wrote:
> OK, now that I have my table of objects produced by a Python script working 
> in ZPT, I need to figure out how to connect an entry in the table to its 
> URL. What is the TAL equivalent of:
> 
> <td><a href="<dtml-var absolute_url>"><dtml-var title></a></td>
> 
> It *seemed* like I should be able to code:
> 
> <td><a 
> href="tal:content='item/absolute_url'"><tal:content="item/title"></a></td>
> 
> But that creates a compilation error in the TAL HTML Parser. Maybe it's a 
> quoting thing (which I had sort of hoped would be cleaner in ZPT than it is 
> with DTML stuff) but I can't find anything in the docs about using 
> absolute_url in TAL, so I'm kinda stuck.

Are you sure the compilation error involves absolute_url? What looks
odd to me in the above snippet is that I've never seen a <tal> tag,
only "tal:" attributes to existing tags.

Try:

<td><a href="/dummyurl"
       tal:attributes="href item/absolute_url"
       tal:content="item/title">Dummy Title</a></td>

www.zope.org/Members/peterbe/DTML2ZPT has quite a few dtml->zpt
translation examples. That and the ZPT chapters of the Zope book
should be useful. The mantra is "nothing I do in ZPT should look odd
to a WYSIWYG editing program; everything dynamic should look like
dummy content."

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu