help with dynamic section...

From: Date: Fri, 02 May 2003 14:51:35 +0000
Subject: help with dynamic section...
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9448@lists.php.net to get a copy of this message
Hi, I've run into a stumbling block that hopefully somebody can help with. I'm unsure how to access a field in an array that is dynamic and not pre-defined. (ie display it on the fly) I have 2 sections loops: pages & users .. with the users being the variable: <table width="80%" class="admin_box"> <tr class="admin_header_box"> <td class="admin_header_box">name</td> <td class="admin_header_box">page</td> <td class="admin_header_box">php</td> <td class="admin_header_box">tpl</td> <td class="admin_header_box">name</td> <td class="admin_header_box">xtra</td> {section name=y loop=$users} <td class="admin_header_box">{$users[y].au_login}</td> <!-- note: this correctly lists the users --> {/section} </tr> {section name=x loop=$pages} {if (($fletch.section.x.rownum / 2) == floor($fletch.section.x.rownum / 2))} <tr bgcolor="#F4F4F4"> {else} <tr bgcolor="white"> {/if} <td>{$pages[x].s_name}</td> <td>{$pages[x].page}</td> <td>{$pages[x].php}</td> <td>{$pages[x].tpl}</td> <td>{$pages[x].name}</td> <td>{$pages[x].xtra}</td> {section name=y loop=$users} <td>{$pages[x].$users[y].au_login}</td> <!--- Not working --> {/section} </tr> {/section} So the problem comes in the second loop on how to access the unknown variables from the users loop. So if the users where Pete, Steve, Sarah it would display as: <td>{$pages[x].Pete}</td> <td>{$pages[x].Steve}</td> <td>{$pages[x].Sarah}</td> any help would be great. - Guido sguido@rogers.com

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