truncating a string

Author Message

Ben Pirt

Wednesday 27 August 2003 3:50:30 pm

Hi all,
is it possible to truncate a string so that I can show the first 30 words (or 150 letters or something) of a story as in introduction into the story on a subsequent page. I see this is included in 3.2, but I would like to try this in 3.1.
Any ideas?
Cheers,
Ben

Paul Forsyth

Thursday 28 August 2003 12:40:14 am

You would need to add this as an operator to allow the underlying php string function through to the template.

In 3.1 have a look at the ez lib file:

lib/eztemplate/classes/eztemplatewashoperator.php:

I see in 3.2 there is a new file for string functions:

lib/eztemplate/classes/eztemplatestringoperator.php

Hopefully from these files you can see what is going on. I find using 'grep' extremely handy to determine which files contain the things im interested in.

Paul

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 31 2025 06:20:27
Script start
Timing: Jan 31 2025 06:20:27
Module start 'layout'
Timing: Jan 31 2025 06:20:27
Module start 'content'
Timing: Jan 31 2025 06:20:28
Module end 'content'
Timing: Jan 31 2025 06:20:28
Script end

Main resources:

Total runtime1.2838 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.1250151.2109
Module start 'layout' 0.00470.0023 739.335936.6328
Module start 'content' 0.00701.2760 775.9688880.2656
Module end 'content' 1.28300.0007 1,656.23447.8750
Script end 1.2837  1,664.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00270.2123160.0002
Check MTime0.00110.0860160.0001
Mysql Total
Database connection0.00070.055510.0007
Mysqli_queries1.236796.3323540.0229
Looping result0.00060.0492520.0000
Template Total1.235696.320.6178
Template load0.00210.160920.0010
Template processing1.233596.088220.6168
Template load and register function0.00140.108710.0014
states
state_id_array0.00290.228510.0029
state_identifier_array0.00320.250120.0016
Override
Cache load0.00170.1337160.0001
Sytem overhead
Fetch class attribute can translate value0.00070.053020.0003
Fetch class attribute name0.00240.183520.0012
XML
Image XML parsing0.00020.019120.0001
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00390.3065100.0004
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs