Forums / Setup & design / Is nested switch case possible

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

eZ debug

Timing: Jan 20 2025 18:10:50
Script start
Timing: Jan 20 2025 18:10:50
Module start 'content'
Timing: Jan 20 2025 18:10:50
Module end 'content'
Timing: Jan 20 2025 18:10:50
Script end

Main resources:

Total runtime0.0203 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.0000180.8359
Module start 'content' 0.00570.0061 769.835993.8984
Module end 'content' 0.01190.0084 863.734470.7031
Script end 0.0203  934.4375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002311.0792120.0002
Check MTime0.00115.2645120.0001
Mysql Total
Database connection0.00073.307410.0007
Mysqli_queries0.002411.722140.0006
Looping result0.00000.052820.0000
Template Total0.008039.310.0080
Template load0.00094.246110.0009
Template processing0.007135.057310.0071
Override
Cache load0.00062.902710.0006
General
dbfile0.003617.7809100.0004
String conversion0.00000.024630.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs