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

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 19 2025 03:31:33
Script start
Timing: Jan 19 2025 03:31:33
Module start 'layout'
Timing: Jan 19 2025 03:31:33
Module start 'content'
Timing: Jan 19 2025 03:31:34
Module end 'content'
Timing: Jan 19 2025 03:31:34
Script end

Main resources:

Total runtime1.5110 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0095 589.2891152.6406
Module start 'layout' 0.00950.0033 741.929739.4922
Module start 'content' 0.01281.4967 781.4219609.4141
Module end 'content' 1.50950.0014 1,390.835912.1250
Script end 1.5109  1,402.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2270160.0002
Check MTime0.00140.0918160.0001
Mysql Total
Database connection0.00210.138710.0021
Mysqli_queries1.438095.1677650.0221
Looping result0.00070.0463630.0000
Template Total1.472297.420.7361
Template load0.00210.139820.0011
Template processing1.470097.291820.7350
Template load and register function0.00020.011310.0002
states
state_id_array0.00150.098110.0015
state_identifier_array0.00180.117520.0009
Override
Cache load0.00170.1145370.0000
Sytem overhead
Fetch class attribute can translate value0.00130.084530.0004
Fetch class attribute name0.00160.105080.0002
XML
Image XML parsing0.00160.106930.0005
class_abstraction
Instantiating content class attribute0.00000.0015100.0000
General
dbfile0.00190.1251280.0001
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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 31
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs