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.