PDA

View Full Version : tpl file on specific category pages


infocraze
09-01-10, 16:29
I need a certain tpl file to be shown only when a particular category is loaded. How do I go about it using the if elseif stuff? Is this possible using the client software?

Your help would be much appreciated.

Thanks.

Andy
09-02-10, 11:12
Ive only just seen this post, so you might already have a solution.

In PHP, you can use a variable for the include file call, but in Smarty, you cant, so as you suggested, if, elseif is your only solution.

You do it like this:


{if $something == 'somethingelse'}

{include file="thisfile.tpl"}

{elseif $something == 'someotherthing'}

{include file="thatfile.tpl"}

{else}

{include file="thisfilehere.tpl"}

{/if}



Smarty documentation on if, else, elseif can be found here:
http://www.smarty.net/manual/en/language.function.if.php