Can't call several IF statements

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
webform
Power Poster
Power Poster
Posts: 507
Joined: Sat Nov 25, 2006 3:39 pm

Can't call several IF statements

Post 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.
Last edited by webform on Mon Sep 21, 2009 10:45 am, edited 1 time in total.
User avatar
webform
Power Poster
Power Poster
Posts: 507
Joined: Sat Nov 25, 2006 3:39 pm

Re: Can't call several IF statements

Post by webform »

Updated problem description hoping it will help with responses!
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Can't call several IF statements

Post 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 =?
User avatar
webform
Power Poster
Power Poster
Posts: 507
Joined: Sat Nov 25, 2006 3:39 pm

Re: Can't call several IF statements

Post 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)!
Pierre M.

Re: Can't call several IF statements

Post 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.
User avatar
webform
Power Poster
Power Poster
Posts: 507
Joined: Sat Nov 25, 2006 3:39 pm

Re: Can't call several IF statements

Post 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  ???
Post Reply

Return to “CMSMS Core”