blingblingpow Posted January 16, 2010 Share Posted January 16, 2010 Is there a PS equal to:if is_home do thiselse do something elseReason:I want to have a full width home page and side bar on internal pages only.To do this I want to add a different CSS ID if on the home page only.I know I can switch columns on/ off but that's not what I want to do. Link to comment Share on other sites More sharing options...
rocky Posted January 17, 2010 Share Posted January 17, 2010 Yes, you can use the following code in a TPL file: {if $page_name == 'index'} ... {else} ... {/if} Link to comment Share on other sites More sharing options...
blingblingpow Posted January 18, 2010 Author Share Posted January 18, 2010 What I'm trying to do is load a different category.tpl depending on which category is displayed.I tried various combinations but nothing works.essentially: if category is birds $smarty->display(_PS_THEME_DIR_.'category_birds.tpl'); elseif category is snakes $smarty->display(_PS_THEME_DIR_.'category_snakes.tpl'); elseif everything else $smarty->display(_PS_THEME_DIR_.'category.tpl'); Sorry for the questions. I do know PHP and spend a lot of time in WordPress but this is slightly different to what I'm used to.Thanks. Link to comment Share on other sites More sharing options...
rocky Posted January 19, 2010 Share Posted January 19, 2010 Try the following: if ($_GET['id_category'] == 2) $smarty->display(_PS_THEME_DIR_.'category_birds.tpl'); else if ($_GET['id_category'] == 3) $smarty->display(_PS_THEME_DIR_.'category_snakes.tpl'); else $smarty->display(_PS_THEME_DIR_.'category.tpl'); where 2 is the id of the birds category and 3 is the id of the snakes category. Link to comment Share on other sites More sharing options...
blingblingpow Posted January 19, 2010 Author Share Posted January 19, 2010 I think I'm getting my curlies mixed up as that's producing errors.I tried: {if ($_GET['id_category'] == 2)} $smarty->display(_PS_THEME_DIR_.'category_birds.tpl'); {else if ($_GET['id_category'] == 3)} $smarty->display(_PS_THEME_DIR_.'category_snakes.tpl'); {else} $smarty->display(_PS_THEME_DIR_.'category.tpl'); {/if} Not right! Link to comment Share on other sites More sharing options...
rocky Posted January 20, 2010 Share Posted January 20, 2010 Are you putting this code in a PHP file or a TPL file? If it is in a PHP file, copy my code exactly, do not add any curly braces like you have in your code. Link to comment Share on other sites More sharing options...
Hedrad Posted December 8, 2010 Share Posted December 8, 2010 {if ($_GET['id_category'] == 2)} $smarty->display(_PS_THEME_DIR_.'category_birds.tpl'); {else if ($_GET['id_category'] == 3)} $smarty->display(_PS_THEME_DIR_.'category_snakes.tpl'); {else} $smarty->display(_PS_THEME_DIR_.'category.tpl'); {/if} in tpl files, solution is this : {if ...} ... {elseif ...} ... {else} ... {/if} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now