[SOLVED] If and else

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
beherenow_uk
Forum Members
Forum Members
Posts: 103
Joined: Fri Nov 28, 2008 11:26 am

[SOLVED] If and else

Post by beherenow_uk »

Hi there,

Why is this code showing the content block input on both admin pages 'Home' and 'Tables' ? Logically I would think it should only show on 'Tables' ?

It only shows the content block data on the 'Tables' page on the front end?

Thanks.

Code: Select all

            {if $page_alias == 'home'}
            	<div class="makepledge">
                  	<a href="contact">View Committee list</a>
                	<a href="pledge" class="last">Make a pledge now</a>
                  <div class="clear"></div>
            	</div>
            {elseif $page_alias == 'Tables'}
             	<div class="makepledge">
                  	<a href="pledge" class="last">Download booking form</a>
              	  <div class="clear"></div>
            	</div>
            	{content block='Schedule of events'}
            {/if}

I have CMSMS 1.11
Last edited by beherenow_uk on Fri Aug 17, 2012 11:59 am, edited 1 time in total.
mrenigma
Forum Members
Forum Members
Posts: 48
Joined: Fri Aug 05, 2011 3:43 pm
Location: London, United Kingdom

Re: If and else

Post by mrenigma »

The smarty templates are not processed in that way.

If you put a input into the template it will show up on every page using that template. Admittedly it would sometimes be handy/nice to have the functionality you suggest but it is probably a pain to instigate.

The only solution would be to have two templates or possibly use the Advanced Content module and then you can add a description to the content block saying to only use this for the specified pages.
~ Life is like water, every movement you make changes the way it flows ~
Jos
Support Guru
Support Guru
Posts: 4017
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: If and else

Post by Jos »

The admin side doesn't check on if/else statements. It just searches for any {content...} tags and shows them.
beherenow_uk
Forum Members
Forum Members
Posts: 103
Joined: Fri Nov 28, 2008 11:26 am

Re: If and else

Post by beherenow_uk »

Great that answers my question. Thanks folks.
Post Reply

Return to “CMSMS Core”