Share » Forums » Setup & design » Help required to correct my Switch...

Help required to correct my Switch condition code

Help required to correct my Switch condition code

Thursday 18 December 2003 1:46:31 am - 3 replies

Modified on Thursday 18 December 2003 1:47:41 am by SathishKumar Subramanian

Author Message

Tore Skobba

Thursday 18 December 2003 2:23:37 am

Hi

Have you tried to debug with writting out the actual values of your variables?

Try this:

{*Get total Count of Study Materials*}
{*Get total Count of Articles*}
{let totalResources=fetch('content','list_count', hash('parent_node_id',$node.node_id,'class_filter_array',array(17),'class_filter_type','include'))

totalArticles=fetch('content','list_count', hash('parent_node_id',$node.node_id,'class_filter_array',array(2),'class_filter_type','include'))

}

Debug: totRes: {$totalResources}
Debug totArt: {$totalArticles}

{section show=gt($totalResources,0)}
<table><tr><td>Message 1 </td></tr></table>
{/section}

{section show=gt($totalArticles,0)}
<table><tr><td>Message 2 </td></tr></table>
{/section}

{/let}

SathishKumar Subramanian

Thursday 18 December 2003 2:39:59 am

Hi,

Sorry, I have missed one more info.
Inside the {section show=(or(gt($totRes:totalResources,0),gt($totRes:totArt:totalArticles,0)))} I am having additional html contents rather than message 1 and 2. So if the total resources or articles count greater than 0 then they should be shown .
So the section before the switch conditions are required.

sathizh

Tore Skobba

Thursday 18 December 2003 6:44:32 am

then just insert this?

{section show=or(gt($totalResources,0),gs($totalArticles,0))}
Common stuff
{/section}

Or alternatively if objective to minimize conditional branches

{section show=gt($totalResources,0)}
Write common stuff
<table><tr><td>Message 1 </td></tr></table>
{/section}

{section show=gt($totalArticles,0)}
Write common stuff
<table><tr><td>Message 2 </td></tr></table>
{/section}

But you should print out your values to check that they are ok.

cheers
Tore

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu