Knowing whether a string appears twice or more times

Knowing whether a string appears twice or more times

Thursday 21 September 2006 3:50:01 am - 2 replies

Author Message

Claudia Kosny

Friday 22 September 2006 12:54:39 am

Hello Alejandro

As far as I know there is no inbuilt way to do this with EZ. But as there is the PHP function substr_count for this, you just need to write an EZ template operator for this. More info about how to do this is here:

http://ez.no/products/ez_publish/documentation/development/extensions/template_operator

Greetings from Luxembourg

Claudia

Softriva .com

Friday 22 September 2006 1:08:26 am

Up to my humble knowledge, you can solve this in two ways,

A. Write your own operator using php.
B. using the existing operator as follows:
1. explode the string into array1 (see link below)
2. use the unique operator of the array1 to make array2.
3. Compare the two arrays if they are the same then there are no repeated words. If not then you can iterate (may sining foreach) through the two arrays to find the duplicate words

May be someone else can help you better than me. I just tried.

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

You must be logged in to post messages in this topic!

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