Forums / Developer / Display first 100 chars

Display first 100 chars

Author Message

David Jones

Wednesday 04 October 2006 4:34:25 am

I have an object with lots of text. I wont to display the first 100 chars of it rather than the whole thing.

I know I've seen this somewhere but I can't seem to find it now.

Could somebody point me in the right direction please.

Thanks

J-A Eberhard

Wednesday 04 October 2006 5:15:08 am

Use the template operator shorten

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/strings/shorten

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Xavier Dutoit

Wednesday 04 October 2006 8:35:27 am

This being said, beware if your attribute is an xml text, as you might cut it between the start end the end of the tag (eg: <b> Char n°100 </b> Would cut the text before the </b> and might seriously screw up your layout.

X+

http://www.sydesy.com

David Jones

Thursday 05 October 2006 12:51:13 am

Thats the one, I knew I'd seen it just couldn't remember what to serach for. I tried all sorts of things.

Anyway, Thanks guys.

eZ debug

Timing: Jan 21 2025 16:03:53
Script start
Timing: Jan 21 2025 16:03:53
Module start 'content'
Timing: Jan 21 2025 16:03:53
Module end 'content'
Timing: Jan 21 2025 16:03:53
Script end

Main resources:

Total runtime0.0320 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.7031180.8438
Module start 'content' 0.00590.0089 768.546993.7578
Module end 'content' 0.01480.0171 862.304770.7031
Script end 0.0319  933.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00216.4693120.0002
Check MTime0.00092.9629120.0001
Mysql Total
Database connection0.00072.248210.0007
Mysqli_queries0.00237.304640.0006
Looping result0.00000.049920.0000
Template Total0.016752.110.0167
Template load0.00082.445510.0008
Template processing0.015949.681710.0159
Override
Cache load0.00051.542510.0005
General
dbfile0.009931.0474100.0010
String conversion0.00000.018630.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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