[Zope] Need some newbie tal help

Tres Seaver tseaver at palladion.com
Tue Oct 5 13:26:23 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/05/2010 01:20 PM, Mark Phillips wrote:
> I have a table and I am putting data into the cells using tal. I want to
> bold the data under a certain condition. I tried this, but it didn't work:
> 
> <td tal:content="string:${player/name}"><b
> tal:condition="python:str(player['name']) == 'Team'">name</b></td>
> 
> The data (player/name) appears correctly, but when player/name='Team', the
> text is not bold. After some reading, I believe what is happening is that
> the tal:content tag is replacing everything between the <td> and the </td>
> tags. Is this correct? I tried this, and no bold either:
> 
> <td tal:content="string:${player/GP}"><b>GP</b></td>
> 
> which supports my hypothesis about the tal:content tag.
> 
> How do I add some "conditional bold effect" in my table data?

You are correct that 'tal:content' on a wrapper element replaces any
markup in the children.  You want to use 'tal:content' on the 'b' tag
itself, and then 'tal:omit-tag' to drop the element (but not its
contents).  See:

http://wiki.zope.org/ZPT/TALSpecification14#omit-tag


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyrX78ACgkQ+gerLs4ltQ4tRQCfU0DN0AVeBSRg/wYjYFGcbAJL
8pUAn3x/KD8/qXdp4acpcIluuVnWvtrv
=l0+r
-----END PGP SIGNATURE-----



More information about the Zope mailing list