Re: [SMARTY] 2.3 to 2.4 incompatibilities
| From: | Monte Ohrt | Date: | Wed, 05 Feb 2003 20:36:50 +0000 |
| Subject: | Re: [SMARTY] 2.3 to 2.4 incompatibilities | ||
| References: | 1 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-665@lists.php.net to get a copy of this message | ||
That is a bug, and now fixed in CVS.
On Tue, 2003-02-04 at 18:16, Jeff McDonald wrote:
> Hi, I just tried out v2.4 and the template below no longer works. I used it
> w/ 2.3 to create dynamic tables and it worked great when combined with a
> grid class. An earlier thread mentioned adding back math tokens, which I
> did. That helped some, but it still wouldn't display unless I changed my
> original elseif to the new one shown below. But this doesn't work correctly
> (all my tables display with only 1 column). The class and template work
> great with 2.3... anyone see what the problem might be? Or if there's a
> better way to do this, I'd be all for that.
>
> Thanks!
>
> Basically I used grid.tpl like so:
>
> $smarty->assign(array(
> 'options' => $this->data, // Array.
> 'numColumns' => $this->numColumns,
> 'numElements' => sizeof($this->data),
> 'border' => $this->border,
> 'cellpadding' => $this->cellPadding,
> 'cellspacing' => $this->cellSpacing,
> 'width' => $this->width,
> 'class' => $this->class,
> 'style' => $this->style
> ));
> $this->output = $smarty->fetch('grid.tpl');
>
>
> -- grid.tpl --
>
> <table border="{$border}" cellpadding="{$cellpadding}"
> cellspacing="{$cellspacing}" width="{$width}" class="{$class}"
> style="{$style}">
> {assign var=counter value=0}
> {foreach from=$options item=item}
> {if $counter mod $numElements == 0}
> <tr>
> {/if}
> <td>{$options[$counter]}</td>
> {if $counter == $numElements - 1}
> </tr>
> {* {elseif ($counter+1) mod $numColumns == 0}*} {*original *}
> {elseif $counter+1 mod $numColumns == 0} {* new *}
> </tr><tr>
> {/if}
> {assign var=counter value=$counter+1}
> {/foreach}
> </table>
--
Monte Ohrt <monte@ispi.net>