substr string

Author Message

LORDLIFEN LIFEN

Wednesday 09 June 2010 8:30:06 am

why my code don't match ? i want to extract some words

{$lost_uri="test01 test02 test02"}
{$lost_uri = substr( $lost_uri, 1 )}
{$lost_uri}

Peter Keung

Wednesday 09 June 2010 9:07:30 am

eZ Publish template code for that looks something like this:

{def $lost_uri = "test01 test02 test02"}
{set $lost_uri = $lost_uri|extract( 1 )}
{$lost_uri}

Out of the box, you cannot directly use PHP functions and must "def" and "set" your variables.

See:

http://ez.no/doc/ez_publish/technical_manual/4_x/templates/the_template_language

http://ez.no/doc/ez_publish/technical_manual/4_x/reference/template_operators/strings/extract

http://ez.no/doc/ez_publish/technical_manual/4_x/reference/template_functions/variables

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

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 18 2025 10:33:41
Script start
Timing: Jan 18 2025 10:33:41
Module start 'layout'
Timing: Jan 18 2025 10:33:41
Module start 'content'
Timing: Jan 18 2025 10:33:41
Module end 'content'
Timing: Jan 18 2025 10:33:41
Script end

Main resources:

Total runtime0.5128 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.7813152.6094
Module start 'layout' 0.00660.0036 740.390639.3984
Module start 'content' 0.01010.5008 779.7891525.3125
Module end 'content' 0.51100.0017 1,305.10168.2031
Script end 0.5127  1,313.3047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.6761160.0002
Check MTime0.00140.2657160.0001
Mysql Total
Database connection0.00080.154110.0008
Mysqli_queries0.465790.8166540.0086
Looping result0.00050.1067520.0000
Template Total0.479293.520.2396
Template load0.00210.400220.0010
Template processing0.477193.052220.2386
Template load and register function0.00010.023810.0001
states
state_id_array0.00090.178610.0009
state_identifier_array0.00190.363520.0009
Override
Cache load0.00170.3326160.0001
Sytem overhead
Fetch class attribute can translate value0.00070.133620.0003
Fetch class attribute name0.00230.454630.0008
XML
Image XML parsing0.00130.252920.0006
class_abstraction
Instantiating content class attribute0.00000.002030.0000
General
dbfile0.00130.2604170.0001
String conversion0.00000.001740.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs