[SMARTY] Weird problem with if-else

"A.J. Brown" <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <00da01c5c2ba$8e452950$b203a8c0@ebizarch>
Hello Everyone,

I'm having a weird Smarty compilation error with the following section of 
code.  The error is "unexpected {else}":

{foreach from=$calendar.weeks item="week"}
  <tr class="calendar_week">
   {foreach from=$week item="day"}
   {if $day.blank eq true}
     <td>&nbsp;</td>
   {else}
    {include file="calendar_cell_bit.tpl"}
   {/if}
   {/foreach}
  </tr>
{/foreach}


At first I thought the problem was with the included file, but I still get 
the error even if I comment out that line.  There are no other {if} 
statements anywhere else in this template, so I'm positive it's not a 
nesting or unclosed {if} problem.

When I use the following code instead, it works perfectly:

{foreach from=$calendar.weeks item="week"}
  <tr class="calendar_week">
   {foreach from=$week item="day"}
   {if $day.blank eq true}
     <td>&nbsp;</td>
   {/if}
   {if $day.blank eq false}
    {include file="calendar_cell_bit.tpl"}
   {/if}
   {/foreach}
  </tr>
{/foreach}


What's up with this?

Sincerely,

A.J. Brown
BitNotion Technologies
[email protected]

----- Original Message ----- 
From: "Oscar Fernandez Sierra" <[email protected]>
To: "v3rb0" <[email protected]>
Cc: <[email protected]>
Sent: Sunday, September 25, 2005 2:24 PM
Subject: Re: [SMARTY] Why do I only show two items when looping


Recordad que en el foro de alonsocampeon tenéis que entrar para generar la
página de opiniones

http://farton.elmundo.int:9090/elmundo/opiniones/index_opiniones.html?anio_creacion_opiniones=2005&opiniones=alonsocampeon
-- 
Oscar Fernandez Sierra    | Mundinteractivos - El Mundo      |
Area de Internet          | Pradillo, 42                     |
[email protected]        | 28002 - Madrid (SPAIN, EU)       |
http://www.elmundo.es/    | Tel: (+34) 915864800 (Ext: 4616) |


On Sun, 25 Sep 2005, v3rb0 wrote:

> use
>
> <ul class="showIt" id="mn1">
>  {foreach from=$links_list->mCategories[cat] item=item key=key}
>    <li class="subLinks">
>      <a href="{$links_list->mLinks[cat][link].linkURL}">
>        {$links_list->mLinks[cat][link].linkTitle}
>      </a>
>    </li>
>  {/foreach}
> </ul>
>
> insetad of
>
>  {section name=link loop=$links_list->mCategories[cat]}
>
> ...
>  {/section}
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.