Forums / Setup & design / how to: use various operators in one instruction?

how to: use various operators in one instruction?

Author Message

Alessandro Cipriani

Monday 26 April 2004 2:28:42 am

hi all
in my pagelayout i need to:

make the md5 of a string
use only the first 8 chars of the resultant string

i tried to:
{"mystring"|md5|shorten(8)}

but didn't work

in general i need to have multiple operators in one instruction string

any hint?
best regards
alessandro

Alex Jones

Monday 26 April 2004 6:53:22 am

I don't know if it is possible to assign multiple operators in one string. But perhaps you could try something along the lines of setting the first modified string as a variable and then outputing the variable with the second operator? Otherwise, you may need to create an operator for each combination of strings. So in this instance you would need to set up a single operator that creates the md5 and then shortens the result to send to the template.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Balazs Halasy

Monday 26 April 2004 7:09:17 am

Hmm, this should be possibe. However, I think you should use the "extract_left" operator instead of "shorten". Have you tried to do it like this?

{"mystring"|md5|extract_left(8)}

The operator is documented here:
http://ez.no/ez_publish/documentation/reference/template_operators/strings/extract_left

Balazs

UPDATE:
I just tested the code above with the latest alpha of 3.4, it works. It should also work with earlier versions of eZ publish.

Alex Jones

Monday 26 April 2004 7:27:12 am

It's good to know that you can use multiple operators like that Balazs! Thanks for posting the info.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alessandro Cipriani

Monday 26 April 2004 7:32:28 am

yes, it works!

thank you
alessandro