Forums / Developer / how to use extract_left ?

how to use extract_left ?

Author Message

kavi kavi

Thursday 18 January 2007 8:47:55 am

Hello !
I want to extract 20 characters from my article.
I didn't find the syntax for using extract_left with {attribute_view_gui attribute=$node.object.data_map.intro}

Someone of you know how to use ????
Thanks
kavi

Luc Chase

Thursday 18 January 2007 8:52:12 am

Did you try?
{attribute_view_gui attribute=$node.object.data_map.intro|extract_left(20)}

The Web Application Service Provider

Nabil Alimi

Thursday 18 January 2007 9:27:19 am

Hi,

This won't work since extract_left should be used on a string.

You need to apply this directly on the output of the content of your datatype.

{$node.data_map.intro.content|extract_left( 20 )}

This means this is incompatible with the attribute_view_gui operator.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

kavi kavi

Friday 19 January 2007 12:41:43 am

Hi Nabil !
thanks for your quick answer.
I've just tried your suggestion. But it doesn't work !!!
My code is in the override/templates/listitem/article.tpl

<li class="extraitNews">
<h1>
<a href={$node.url_alias|ezurl} title="Lien vers : {$node.object.data_map.title.content|wash}">{$node.object.data_map.title.content|wash}</a>
</h1>

<p>{attribute_view_gui attribute=$node.object.data_map.intro} </p>
</li>

If extract_left is incompatible with attribute_view_gui, do you think that i've to modify another template..?!
kavi