X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   If statement with multiple categories (https://forum.x-cart.com/showthread.php?t=60942)

someguy03 09-20-2011 09:06 AM

If statement with multiple categories
 
I am using this if statement:

{if $cat eq "264"}
Code
{else}
Code
{/if}

But I want to have category 264, 271, 275, etc. How can I format the statement to have multiple category numbers?

Also, how can I have a negative if statement? So I can tell something to NOT display if it is a certain category.

totaltec 09-20-2011 09:13 AM

Re: If statement with multiple categories
 
Quote:

Originally Posted by someguy03
I want to have category 264, 271, 275, etc. How can I format the statement to have multiple category numbers?

Really easy, you will laugh:
Code:

{if $cat eq "264" or $cat eq "271" or $cat eq "275"}
Code
{else}
Code
{/if}

Quote:

Originally Posted by someguy03
Also, how can I have a negative if statement? So I can tell something to NOT display if it is a certain category.

Again easy (thankfully):
Code:

{if $cat ne "264"}
Code
{/if}

Smarty is so simple and makes so much sense.


All times are GMT -8. The time now is 09:51 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.