Switch Case Problem

Author Message

Muhammad Khalid Majeed

Friday 07 May 2004 5:05:32 am

I am using switch case as:

{switch name=Sw1 match=$node.object.data_map.article_image2.content[original].full_path|ezroot}
{case match=''}
Null Value
{/case}
{case}
Hello World
{/case}
{/switch}

This is working. But when i change my code on my requirement with the following

{switch name=Sw1 match=$node.object.data_map.article_image2.content[original].full_path|ezroot}
{case match=''}
Null Value
{/case}
{case}
{set imgg="Hello World"}
{$imgg}
{/case}
{/switch}
OR
{switch name=Sw1 match=$node.object.data_map.article_image2.content[original].full_path|ezroot}
{case match=''}
Null Value
{/case}
{case}
{let imgg="Hello World"}
{$imgg}
{/let}
{/case}
{/switch}

Then this is not working.

Can any body solve my problem?

Muhammad Khalid
Software Engineer
www.webgurru.net

Paul Forsyth

Friday 07 May 2004 5:37:43 am

From your second case try:

{let imgg=0}

{switch name=Sw1 match=$node.object.data_map.article_image2.content[original].full_path|ezroot}
{case match=''}
Null Value
{/case}
{case}
{set imgg="Hello World"}
{$imgg}
{/case}
{/switch}

{/let}

What is the output now? Can you be explicit here - in your example you didnt specify what the output was.

paul

--
http://www.visionwt.com

Muhammad Khalid Majeed

Friday 07 May 2004 5:39:58 am

If the match='' then the value printed "Null Value"
Otherwise if i wrote
{case}
ello World
{/case}

The value printed "Hello World".

If I wrote the value {case}
{let imgg="Hello World"}
{$imgg}
{/let}
{/case}

Output is nothing just blank.

This is confusing me why it is not working.

Muhammad Khalid
Software Engineer
www.webgurru.net

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 22:11:07
Script start
Timing: Jan 18 2025 22:11:07
Module start 'layout'
Timing: Jan 18 2025 22:11:07
Module start 'content'
Timing: Jan 18 2025 22:11:08
Module end 'content'
Timing: Jan 18 2025 22:11:08
Script end

Main resources:

Total runtime0.6524 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 587.8125152.6094
Module start 'layout' 0.00460.0030 740.421939.4141
Module start 'content' 0.00760.6434 779.8359505.1172
Module end 'content' 0.65110.0013 1,284.953112.1875
Script end 0.6523  1,297.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4543160.0002
Check MTime0.00130.1929160.0001
Mysql Total
Database connection0.00060.097510.0006
Mysqli_queries0.600992.1051570.0105
Looping result0.00040.0687550.0000
Template Total0.626096.020.3130
Template load0.00210.316820.0010
Template processing0.623995.641220.3120
Template load and register function0.00010.015210.0001
states
state_id_array0.00070.100410.0007
state_identifier_array0.00090.130620.0004
Override
Cache load0.00170.2657560.0000
Sytem overhead
Fetch class attribute can translate value0.00050.071720.0002
Fetch class attribute name0.00100.149030.0003
XML
Image XML parsing0.00030.039120.0001
class_abstraction
Instantiating content class attribute0.00000.001230.0000
General
dbfile0.00060.0889100.0001
String conversion0.00000.001140.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs