Page 1 of 1

[SOLVED] If and else

Posted: Fri Aug 17, 2012 11:30 am
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

Re: If and else

Posted: Fri Aug 17, 2012 11:34 am
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.

Re: If and else

Posted: Fri Aug 17, 2012 11:36 am
by Jos
The admin side doesn't check on if/else statements. It just searches for any {content...} tags and shows them.

Re: If and else

Posted: Fri Aug 17, 2012 11:37 am
by beherenow_uk
Great that answers my question. Thanks folks.