Switch : Counting chars to execute code...

Author Message

Jorge estévez

Monday 25 October 2004 4:55:43 am

I would like to execute a code if a string is bigger than 16 characters and another code if not, I tryed this code but with no results, can someone point out how to please...

{let littletext=array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)}
	
{section show=$littletext|contains({$node.name|16}) }
{*short*}

do this if text is less than 16 chars...
{section-else}

{*bigtext*}
			
do this if text is bigger than 16 chars...


{/section}
			
			{/let}


Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Tuesday 26 October 2004 8:52:37 pm

Please help me with this

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Sunday 31 October 2004 3:59:02 am

Please help

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Marco Zinn

Sunday 31 October 2004 7:11:48 am

Hi,

if you are talking about a string and want to switch based on the number of characters, you should have a look at the count-function.

Pseudo-code

{section show=your_string_var$|count()|gt(16)}
more than 16 chars
{section-else}
not more than 16 chars
{/section}

Marco
http://www.hyperroad-design.com

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

Main resources:

Total runtime0.7222 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.2734152.6406
Module start 'layout' 0.00450.0018 741.914139.4766
Module start 'content' 0.00640.7143 781.3906539.5234
Module end 'content' 0.72070.0014 1,320.914112.1250
Script end 0.7221  1,333.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4209160.0002
Check MTime0.00130.1795160.0001
Mysql Total
Database connection0.00070.095310.0007
Mysqli_queries0.678593.9519600.0113
Looping result0.00040.0584580.0000
Template Total0.698796.720.3493
Template load0.00190.264420.0010
Template processing0.696796.474420.3484
Template load and register function0.00020.024610.0002
states
state_id_array0.00080.105810.0008
state_identifier_array0.00070.092520.0003
Override
Cache load0.00150.2144160.0001
Sytem overhead
Fetch class attribute can translate value0.00060.080120.0003
Fetch class attribute name0.00100.136150.0002
XML
Image XML parsing0.00060.088820.0003
class_abstraction
Instantiating content class attribute0.00000.004250.0000
General
dbfile0.00070.1003160.0000
String conversion0.00000.001040.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
4content/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
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs