Re: [SMARTY-GENERAL] If statements

From: Date: Mon, 01 Apr 2002 18:38:37 +0000
Subject: Re: [SMARTY-GENERAL] If statements
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3421@lists.php.net to get a copy of this message
Yes, but since you're in a section loop you have to reference the correct index. {section name=foo ...} {if $IS_SECTION[foo] eq "Y"} {/section} Also, you could assign true/false to IS_SECTION instead of "Y"/"N", then you could just do {if $IS_SECTION[foo]} as a boolean comparison. Brad Atkins wrote:
Hey Monte, We do the following
       $tplassigns[] = array(
        'ID' => $RESULT24->fields['SECTID24'],
        'CATEGORY_ID' => "",
         'NAME' => $NAME,
       'IS_SECTION' => "Y" );
$tpl->assign( 'SECTIONS', $tplassigns ); So how would I reference that, IS_SECTION? {if $SECTION.IS_SECTION eq "Y"} Thanks, Brad Atkins Manager, Technical Development Sales: 1-877-973-2278 Support: 1-877-973-4968 Email: brad@youreshop.com ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "Brad Atkins" <brad@youreshop.com> Cc: <smarty-general@lists.php.net> Sent: Monday, April 01, 2002 1:20 PM Subject: Re: [SMARTY-GENERAL] If statements
You can't nest template tags, that is against syntax rules. This is in the FAQ. do this: {if $var eq "Y"} Monte Brad Atkins wrote:
Hello, I have the following code: [foreach item=SECTION from=$SECTIONS]
    [$SECTION.NAME]
[/foreach] SECTION has various elements such as NAME IMAGE LINK IS_SECTION etc... The IS_SECTION is of particular interest. The IS_SECTION contains a Y or
an N, depend on whether or not it's a section or a category.
Is it possible to do something like: [if [$SECTION.IS_SECTION] == "Y"] When I do that I get the following: Parse error: parse error in
/var/www/virtuals/youreshop/dev/2002-smarty/hp/templates_c/50/5088fd25b0c0af 451d7b67edd1bcedde/d41d8cd98f00b204e9800998ecf8427e.php on line 34
Any ideas? Thanks, Brad Atkins Manager, Technical Development Sales: 1-877-973-2278 Support: 1-877-973-4968 Email: brad@youreshop.com
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#3421) next »