switches and correct use of template operators

Author Message

James Packham

Thursday 07 April 2005 11:29:48 am

Hi all,

I haven't used ez for a while and I'm struggling a bit with my switches. Does anyone know what I need to change to get it to recognise my template operators (is_integer and is_float)?

{section loop=$image_list}
    {switch match=true}
        {case match=is_integer($count|div(2))}
	   [code]
	{/case}
        {case match=is_float($count|div(2))}
	   [code]
	{/case}
    {/switch}
    {set count=$count|inc}
{/section}

At the moment it tells me all instances of $count / 2 are floats, even though some of them are really integers... When I use them outside of the loop I find that I have both floats and integers...

I'm running ezp 3.5.1, if that's relevant.

Ɓukasz Serwatka

Wednesday 13 April 2005 12:28:33 am

Hi James,

You can use if condition

{*
    if true display code
*}
{section show=true}
    [code]
{*
    if not true display something else
*}
{section-else}
    [code]
{/section}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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 15:00:22
Script start
Timing: Jan 18 2025 15:00:22
Module start 'layout'
Timing: Jan 18 2025 15:00:22
Module start 'content'
Timing: Jan 18 2025 15:00:23
Module end 'content'
Timing: Jan 18 2025 15:00:23
Script end

Main resources:

Total runtime1.2775 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.0051 589.1797152.6406
Module start 'layout' 0.00510.0041 741.820339.4922
Module start 'content' 0.00921.2668 781.3125533.2422
Module end 'content' 1.27600.0014 1,314.55478.1250
Script end 1.2775  1,322.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2694160.0002
Check MTime0.00130.1030160.0001
Mysql Total
Database connection0.00100.080910.0010
Mysqli_queries1.227896.1067540.0227
Looping result0.00060.0451520.0000
Template Total1.237596.920.6187
Template load0.00210.166620.0011
Template processing1.235396.696620.6177
Template load and register function0.00010.011110.0001
states
state_id_array0.00140.107510.0014
state_identifier_array0.00120.096220.0006
Override
Cache load0.00180.1385140.0001
Sytem overhead
Fetch class attribute can translate value0.00090.068420.0004
Fetch class attribute name0.00100.080940.0003
XML
Image XML parsing0.00120.094320.0006
class_abstraction
Instantiating content class attribute0.00000.000540.0000
General
dbfile0.00200.1567240.0001
String conversion0.00000.000640.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/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
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: 6

Time used to render debug report: 0.0002 secs