[Zope] Embedding absolute_url in TAL Syntax

Chris Withers chrisw@nipltd.com
Mon, 10 Jun 2002 15:27:36 +0100


Hi Dan,

Dan Shafer wrote:
> 
> >In addition:
> >
> ><tal:content="item/title">
> >
> >...is very wrong ;-)
> >
> >If you want to do it like that, you need:
> >
> ><tal:x replace="item/title" />
> 
> OK, Chris, I'll take your word that my approach was "very wrong" (even with
> the winkie). But that is precisely what is taught in Evan Simpson's basic
> ZPT tutorial.

The very wrong bit is the <tal:content bit.

That needs to be either:

<x tal:content

or

<tal:x content

but never <tal:content

> tal: became the tag. (My understanding is that won't work, that tal: always
> has to be an attribute of a known HTML tag, right?)

That tag doesn't have to be known or HTML but it does have to be there ;-)

> there? The tutorial uses replace and content seemingly interchangeably, or
> at least doesn't explain the difference very clearly or prominently.

Well, the difference is pretty obvious ;-)

'content' replaces just the content of the tag it's an attribute of:
<p tal:content="string:die">hello</p>
...renders to:
<p>die</p>

'replace' replaces everything including the tag it's an attribute of:
<p tal:replace="string:die">hello</p>
...renders to:
die

cheers,

Chris