Is nested switch case possible

Author Message

James Ward

Tuesday 29 March 2005 12:25:08 pm

The following code does not work the error message complains about unterminated case. Using 3.5.0.

{switch match=$module_result.section_id}
  {case match=5}
    {switch match=$module_result.node_id}
      {case match=66}
        {* do nothing *}
      {/case}
      {case}
        {include uri="design:gutter/staff.tpl"}
      (/case}
    {/switch}
    {include uri="design:gutter/newsletter.tpl"}
  {/case}
  {case}
    {* do nothing *}
  {/case}
{/switch}

Maybe this is not even possible and I should be looking to do this another way. Thanks in advance.

working at www.wardnet.com
blogging at www.jamesward.ca

Ɓukasz Serwatka

Tuesday 29 March 2005 10:07:41 pm

Hi James,

During development it`s good to have debug enabled. Shows all errors,lines numbers, etc.

In site.ini.append.php

[DebugSettings]
DebugOutput=enabled

In your code is parse error:

{switch match=$module_result.section_id}
  {case match=5}
    {switch match=$module_result.node_id}
      {case match=66}
        {* do nothing *}
      {/case}
      {case}
        {include uri="design:gutter/staff.tpl"}
      {/case} <-- here was ( instead of { ;-)
    {/switch}
    {include uri="design:gutter/newsletter.tpl"}
  {/case}
  {case}
    {* do nothing *}
  {/case}
{/switch}

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 19 2025 12:51:14
Script start
Timing: Jan 19 2025 12:51:14
Module start 'layout'
Timing: Jan 19 2025 12:51:14
Module start 'content'
Timing: Jan 19 2025 12:51:15
Module end 'content'
Timing: Jan 19 2025 12:51:15
Script end

Main resources:

Total runtime0.9398 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.0048 590.2734152.6250
Module start 'layout' 0.00480.0027 742.898439.4609
Module start 'content' 0.00750.9311 782.3594534.6797
Module end 'content' 0.93860.0012 1,317.03918.1641
Script end 0.9398  1,325.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3311160.0002
Check MTime0.00120.1304160.0001
Mysql Total
Database connection0.00080.082110.0008
Mysqli_queries0.892894.9950540.0165
Looping result0.00050.0483520.0000
Template Total0.912397.120.4561
Template load0.00200.209320.0010
Template processing0.910396.855920.4551
Template load and register function0.00010.011510.0001
states
state_id_array0.00070.076710.0007
state_identifier_array0.00060.066320.0003
Override
Cache load0.00160.1664150.0001
Sytem overhead
Fetch class attribute can translate value0.00100.104920.0005
Fetch class attribute name0.00110.112140.0003
XML
Image XML parsing0.00250.263120.0012
class_abstraction
Instantiating content class attribute0.00000.002240.0000
General
dbfile0.00300.3180240.0001
String conversion0.00000.000740.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
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/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: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs