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

hyslx27@gmail.com

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

hyslx27@gmail.com

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:06:22
Script start
Timing: Jan 18 2025 11:06:22
Module start 'layout'
Timing: Jan 18 2025 11:06:22
Module start 'content'
Timing: Jan 18 2025 11:06:22
Module end 'content'
Timing: Jan 18 2025 11:06:22
Script end

Main resources:

Total runtime0.0195 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 588.0469152.6406
Module start 'layout' 0.00600.0035 740.687539.4766
Module start 'content' 0.00960.0076 780.164193.4922
Module end 'content' 0.01710.0023 873.656334.3047
Script end 0.0195  907.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003216.5254140.0002
Check MTime0.00136.6031140.0001
Mysql Total
Database connection0.00105.195710.0010
Mysqli_queries0.002713.598330.0009
Looping result0.00000.122210.0000
Template Total0.00199.610.0019
Template load0.00115.457110.0011
Template processing0.00084.088910.0008
Override
Cache load0.00073.674710.0007
General
dbfile0.00157.653780.0002
String conversion0.00000.047640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs