Smarty Syntax {elseif} - help needed
Hi guys
Hows it going? I am having some problems getting some smarty syntax to work and was wondering if anyone has used something similar. Here is what I have Code:
{if $cat eq "1"} When I use this code - CONTENT 'A' and 'C' work fine - but content 'B' is ignored. I pulled this of the smarty template site and the only difference I can see is that they use the $name throughout whereas I use $cat and $productid. If this is the problem, has anyone got any ideas on how to get around this? Code:
{if $name eq "Fred"} Cheers Tye |
Where's your
{/if} in your code? Also, have you tried printing out $productid to see that a value exists for it? I find doing a simple variable print out in smarty and/or php can sometimes be the quickest way to debug something that's not working as you expect it to. HTH! Carrie |
Hi Carrie
thanks for taking time to reply. My {/if} is there - I just forgot to post it :oops: My product is also there, I think... I am not sure what you mean when you say Print the variable... is that like Code:
<? echo '$productid'; ?> This product is displaying in the store if this helps. |
Quote:
thats php not smarty to show a variable use {$productid} etc also make sure that {$productid} is a valid variable first |
Thanks Shan
Its late here, I'm tired - I'll have another look tomorrow. Cheers |
I'm guessing it may be more like
{$product.productid} to print the variable out (and to use it) unless you've changed something in the php code assuming you're doing this in skin1/customer/main/product.tpl So if {$productid} doesn't print anything to the screen, then try {$product.productid} If that doesn't work, let us know what tpl this code is for and maybe that will help. Carrie |
I love you, I love you all :D
Thanks Carrie and Shan. It was late last night and I was getting mixed up with smarty and php :x My correct code should have been Code:
{if $cat eq "1"} Thanks again Tye |
All times are GMT -8. The time now is 07:54 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.