2.3 to 2.4 incompatibilities
| From: | Jeff McDonald | Date: | Wed, 05 Feb 2003 00:16:42 +0000 |
| Subject: | 2.3 to 2.4 incompatibilities | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7518@lists.php.net to get a copy of this message | ||
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>