Page 1 of 1
Can't call several IF statements
Posted: Mon Sep 14, 2009 2:20 pm
by webform
I have a weird issue or i'm just misunderstanding something!
I seem only to call an IF statement in a template once. If i have something like this in my template:
Code: Select all
{if $sub_template == 8}
Show something
{/if}
That works fine, but if i reuse the same IF statement in another section of the template it doesn't load anything in that section! If i delete the working IF statement, the second one start to work!
But i can reuse another IF statement throughout the template without problems:
Code: Select all
{if $friendly_position == 2.1}
Show something
{/if}
I'm using CMSMS 1.6.5.
Re: Can't call several IF statements
Posted: Mon Sep 21, 2009 10:48 am
by webform
Updated problem description hoping it will help with responses!
Re: Can't call several IF statements
Posted: Mon Sep 21, 2009 11:42 am
by Jos
That indeed doesn't make sence, unless the variable $sub_template gets another value in the meantime.
Are you sure you use double == ? and not a single =?
Re: Can't call several IF statements
Posted: Mon Sep 21, 2009 12:12 pm
by webform
Yes i use double ==
A further test show the result is very dependant of where i put the IF statements in the template:
Doesn't work at all
Code: Select all
<!-- start content -->
<div id="content">
{if $sub_template == 8}
<p>Test 1</p>
{/if}
{if $sub_template == 8}
<p>Test 2</p>
{/if}
{if $friendly_position != 2.1}<h1>{title}</h1>{/if}
{content}
</div>
<!-- end content -->
Only show Test 2
Code: Select all
<!-- start content -->
<div id="content">
{if $sub_template == 8}
<p>Test 1</p>
{/if}
{if $friendly_position != 2.1}<h1>{title}</h1>{/if}
{content}
{if $sub_template == 8}
<p>Test 2</p>
{/if}
</div>
<!-- end content -->
Show both Test 1 & Test 2
Code: Select all
<!-- start content -->
<div id="content">
{if $friendly_position != 2.1}<h1>{title}</h1>{/if}
{content}
{if $sub_template == 8}
<p>Test 1</p>
{/if}
{if $sub_template == 8}
<p>Test 2</p>
{/if}
</div>
<!-- end content -->
Those there is not showing isn't visible in the Source code either - So it's proberly not a CSS issue?
The common thread is the result only showing when placed further down than {content} except {if $friendly_position != 2.1} work wherever i place it in the template!
It's properly very logic but i just can't see it (yet)!
Re: Can't call several IF statements
Posted: Tue Sep 22, 2009 2:32 pm
by Pierre M.
Does the "~process all template/page" switch of config.php change something ?
Another idea : type ; should ==8 be =='8' or =="8" or ? (I'm not a Smarty guy).
Pierre M.
Re: Can't call several IF statements
Posted: Tue Sep 22, 2009 3:18 pm
by webform
No difference in results if i use no quotes, single- or double quotes or setting process_whole_template to either true or false!
This really got me stumpedĀ
