Nested loops

From: Date: Thu, 29 Jul 2004 14:19:43 +0000
Subject: Nested loops
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11642@lists.php.net to get a copy of this message
Hi, I have a requirement. This is a brief description: university courses with some of their readings. I want them to look like: ============================================================================ =========== Ref COURSE Start End ============================================================================ =========== 001 Nursing 101 21/12/2004 20/06/2005 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ID Description = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 01 Article 1 from Nursing times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 02 Article 2 from Nursing times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 03 Article 3 from Nursing times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 04 Article 4 from Nursing times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ============================================================================ =========== Ref COURSE Start End ============================================================================ =========== 002 Midwifery 101 21/12/2004 20/06/2005 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ID Description = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 11 Article 1 from Midwifery times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 12 Article 2 from Midwifery times (full biblio goes here) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = And so on. My code looks like this: (real code, unlike mickey-mouse example above) ============================================================================ =========== {section name=nr1 loop=$results} <table border=0 cellspace=3 width=100%> <tr bgcolor='#336699'> <td align='center'><font size='2' color='#FFFFFF'><b>Module</b></font></td> <td align='center'><font size='2' color='#FFFFFF'><b>Lecturer</b></font></td> <td align='center'><font size='2' color='#FFFFFF'><b>Start</b></font></td> <td align='center'><font size='2' color='#FFFFFF'><b>End</b></font></td> <td align='center'><font size='2' color='#FFFFFF'><b>Students</b></font></td> </tr> <tr bgcolor='#99CCFF'> <td align='center'><font size='1'>{$results[nr1].Module}</font></td> <td align='center'><font size='1'>{$results[nr1].Lecturer}</font></td> <td align='center'><font size='1'>{$results[nr1].Start}</font></td> <td align='center'><font size='1'>{$results[nr1].End}</font></td> <td align='center'><font size='1'>{$results[nr1].Students}</font></td> </tr> </table> <table onclick="sortColumn(event)" border=0 cellspace=6 width=100% cellpadding=6> <thead> <tr valign='bottom' bgcolor='#336699'> <td><font size='1' color='#FFFFFF'><b>ID</b></font></td> <td><font size='1' color='#FFFFFF'><b>Description</b></font></td> </tr> </thead> {section name=nr2 loop=$results[nr1].results_t} <tr valign='top' bgcolor='#99CCFF'> <td align='left'><font size='1' color='#000000'><a href='transaction.php?tr_id={$results[nr1].results_t[nr2].tr_id}&p_id={$resu lts[nr1].p_id}'>ACTIVE<br>DETAIL</a></font></td> <td><font size='1' color='#000000'>{$results[nr1].results_t[nr2].Biblio}</font></td> </tr> </section} </table> {/section} ============================================================================ =========== However, I seem to get the same stuff repeating over and over, not what I expected and no error messages. Any ideas how I can get my design to work? Cheers George in Oxford

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