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.