hello I would like to know if there is a way to truncate a string while displaying it in a table using TAL, as the following code allows it in classic DTML code : <dtml-var mystring size=10 etc=", etc.">. actually the TAL code is : <td tal:content=mystring>dummy string</td> thank you for your answer
On Tue, Aug 13, 2002 at 04:02:44PM +0200, STACCINI PASCAL CHU Nice wrote:
hello I would like to know if there is a way to truncate a string while displaying it in a table using TAL, as the following code allows it in classic DTML code : <dtml-var mystring size=10 etc=", etc.">. actually the TAL code is : <td tal:content=mystring>dummy string</td> thank you for your answer
TAL doesn't provide this, but you can use a python string slice: <td tal:content="python:context.mystring[:10]">dummy string</td> You might need to use something other than "context", depending on where "mystring" comes from. -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"
Paul Winkler wrote:
TAL doesn't provide this, but you can use a python string slice: <td tal:content="python:context.mystring[:10]">dummy string</td>
You might need to use something other than "context", depending on where "mystring" comes from.
you mean 'here', not 'context'. cheers, Chris . o O ( why, god, must we have so many damn names for the same thing?! self, here, context, sequence-item, etc, etc :-( )
On Wed, Aug 14, 2002 at 10:01:08AM +0100, Chris Withers wrote:
Paul Winkler wrote:
TAL doesn't provide this, but you can use a python string slice: <td tal:content="python:context.mystring[:10]">dummy string</td>
You might need to use something other than "context", depending on where "mystring" comes from.
you mean 'here', not 'context'.
aargh! "here" in zpt, even within python expressions... but "context" in python scripts. AFAICT they mean exactly the same thing. Yuck. I hope this will be unified in zope 3. I'm gonna go write that on the board 100 times... -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"
participants (3)
-
Chris Withers -
Paul Winkler -
STACCINI PASCAL CHU Nice