I played with this solution quite a bit, and it seems it works fine only with static tables. But, I use Iterator class to generate table entries and I get the message "Can't to use Iterator class as an array" with entry data[ repeat.datarow.index-1][3]. Thanks anyway. Nice solution though.
2008/3/24, Krzysztof Sikorski <[EMAIL PROTECTED]>: > > I think I got the solution to your problem. Try this kind of template: > > <table> > <tr tal:repeat="datarow data"> > <td tal:content="repeat/datarow/index">row number</td> > <td tal:content="datarow/0">row[0]</td> > <td tal:content="datarow/1">row[1]</td> > <td tal:content="datarow/2">row[2]</td> > <td tal:content="datarow/3">sum</td> > <tal:block condition="repeat/datarow/start"> > <td>---</td> > <td>---</td> > </tal:block> > <tal:block condition="not: repeat/datarow/start"> > <td tal:content="php: data[repeat.datarow.index-1][3]">prev_sum</td> > <td tal:content="php: datarow[3] - data[repeat.datarow.index-1 > ][3]">delta</td> > </tal:block> > </tr> > </table> > > I tried to write it in a self-explaining way. > > P.S.:I assumed the data from DB is in this form: > $data = array( > 0 => array('1','2','2','5'), > 1 => array('3','4','5','12'), > 2 => array('0','2','1','3'), > ); > If I'm wrong, you should at least get the idea of the solution. > > > _______________________________________________ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal > -- Krzysztof Zaleski CCNP, JNCIS Tel.: +48 667 668 428 E-mail: [EMAIL PROTECTED]
_______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal