Forums / Setup & design / limit number of words in template?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

limit number of words in template?

Author Message

Dan Zembrosky

Thursday 05 June 2003 12:38:25 am

Is there any way to make it so a template only displays 150 or whatever number of words from an xml field so I can just have my article line class do that rather than requireing an intro followed by a body? It really wouild make alot more sense.

Bård Farstad

Thursday 05 June 2003 1:10:50 am

To do this you need a template operator to truncate the text after n number of words.

E.g.
{"This is my text with alot of words"|wordtrunc(4)}

The wordtrunc operator would parse the text and remove everything after the first 4 words.

PS: the wordtrunc operator needs to be written. You can use the RAD tool in Exponential 3.1 to generate the basic class.

-bård

Documentation: http://ez.no/doc