Forums / Developer / How to get an xml block attribute raw content

How to get an xml block attribute raw content

Author Message

Eason Huang

Thursday 26 February 2009 7:44:10 pm

How to get an xml block attribute raw content in template file, and only display first 250 characters?

skype:hyslx27

[email protected]

justin kazadi

Thursday 26 February 2009 11:52:49 pm

Hi,
to get an xml block attribute raw content, use this:

 {$node.data_map.name_of_your_attribute.content.output.output_text}

and the shorten operator Returns a shortened version of the input string.

 shorten()

try this in your case:

 {$node.data_map.name_of_your_attribute.content.output.output_text|shorten(250)}

check the technical manual for more information about the shorten operator.

i think this can help you.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Eason Huang

Friday 27 February 2009 1:27:35 am

Thank you very much! Justin

skype:hyslx27

[email protected]

Carlos Revillo

Friday 27 February 2009 3:14:04 am

Be careful usign shorten with xml block attributes. It may happens that maybe the last 5 of the 250 characters are something like

<b>te

and because of that you can get all the rest of your page in bold... use strip_tags for avoid this.

Yannick Komotir

Friday 27 February 2009 5:54:38 am

the xmlwash extension http://projects.ez.no/xmlwash solve this problem. see "how to use" section for working with it.

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk