Re: 2.3 to 2.4 incompatibilities

From: Date: Wed, 05 Feb 2003 00:59:41 +0000
Subject: Re: 2.3 to 2.4 incompatibilities
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7519@lists.php.net to get a copy of this message
Ok, I figured it out, posting in case anyone finds this useful -- grid.tpl -- <table border="{$border}" cellpadding="{$cellpadding}" cellspacing="{$cellspacing}" width="{$width}" class="{$class}" style="{$style}"> {section name=mysection loop=$options} {assign var=myindex value=$smarty.section.mysection.index} {if $myindex mod $numElements == 0} <tr> {/if} <td>{$options[$myindex]}</td> {if $myindex == ($numElements - 1)} </tr> {elseif $smarty.section.mysection.index_next mod $numColumns == 0} </tr><tr> {/if} {/section} </table> "Jeff McDonald" <jeff@cloud9.net> wrote in message news:20030205001429.18259.qmail@pb1.pair.com... > 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> > >

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