Re: #EVEN
| From: | Andrei Zmievski | Date: | Tue, 06 Mar 2001 14:09:12 +0000 |
| Subject: | Re: #EVEN | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-317@lists.php.net to get a copy of this message | ||
On Tue, 06 Mar 2001, Philip Olson wrote:
> Hi. I'm very new to Smarty and am having an annoying problem. I do the
> following within a looped section :
>
> {if #EVEN}
> a
> {else}
> b
> {/if}
>
> Yet I get a parse error because within the compiled template it turns the
> above into this :
>
> <?php if (#EVEN): ?>
> a
> <?php else: ?>
> b
> <?php endif; ?>
>
> This could be something simple and silly yet I've tried a few settings to
> no avail. I essentially copied this use of #EVEN from Smarty real world
> example. I can do "normal" if statements just fine. Am I to use {if
> count is even} instead? If so, what is count? Using 1.3.0 and in process
> of reading DOCS.
It depends on what you want to test for 'evenness'. If current section
iteration, then try:
{if %mysection.index% is even}
even
{else}
odd
{/if}
-Andrei
"Later in this talk, I intend to define
the universe and give three examples." -- Larry Wall