Re: [SMARTY] Am I being daft? Arrays...
| From: | John Wards | Date: | Mon, 07 Apr 2003 15:29:41 +0000 |
| Subject: | Re: [SMARTY] Am I being daft? Arrays... | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9166@lists.php.net to get a copy of this message | ||
Hi,
I have 2 arrays.
$sections
sec_id => section_name
$subsections
sec_id => sub_sec_id => section_name
I need to get the key value from $sections (which is sec_id) to get the data
from $subsections.
I thought $smarty.section.sections.index would do it but it didn't
This is my Smarty template:
{section name=main_sec loop=$sections}
<tr>
<td width="64%" align="left" valign="middle">
{$sections[main_sec]}
</font></b></font></td>
<td width="36%" align="left" valign="middle">
<form method="post" action="">
<INPUT type="hidden" name="section_id"
value="{$smarty.section.sections.index}">
<input type="submit" name="edit" value="Edit">
<input type="submit" name="delete" value="Delete">
</form>
</td>
</tr>
{section name=sub_sec loop=$subsections[$smarty.section.sections.index]}
<tr>
<td width="64%">
<blockquote><font face="Verdana, Arial, Helvetica, sans-serif"
size="2"
color="#000000"><b>
{$subsections[sub_sec]}
</b></font></blockquote>
</td>
<td width="36%" align="left" valign="middle">
<form method="post" action="">
<INPUT type="hidden" name="section_id"
value="{$smarty.section.subsections.index}">
<input type="submit" name="edit" value="Edit">
<input type="submit" name="delete" value="Delete">
</form>
</td>
</tr>
{/section}
{/section}