I tried to follow your example, but i can't seem to get nested each's to work. For example, let's look at garage module. If I want a table to look like this:
Location = England
Car 1
Car 2
Location = France
Car 3
I tried this but it doesn't give me the expected result.
$cars[] = array(
"locname" => $loc->L_name,
"options" => array(
"name" => $car->CA_name,
"location" => $loc->L_name,
"damage" => $car->GA_damage.'%',
"id" => $car->GA_id,
"value" => number_format($value)
),
array(
"locname" => $loc->L_name,
"options" => array(
"name" => $car->CA_name,
"location" => $loc->L_name,
"damage" => $car->GA_damage.'%',
"id" => $car->GA_id,
"value" => number_format($value)
)
)
);
}
$this->html .= $this->page->buildElement('garage', array("cars" => $cars));
<tbody>
{#unless cars}
<tr>
<td colspan="5">
<div class="text-center">
<em> You have no cars</em>
</div>
</td>
</tr>
{/unless}
{#each cars}
<h1>{locname}</h1>
{#each options}
<tr>
<td>{name}</td>
<td>{damage}</td>
<td>${value}</td>
<td>{location}</td>
<td class="text-center">
<a href="?page=garage&action=sell&id={id}">Sell</a>
<a href="?page=garage&action=crush&id={id}">Crush</a>
<a href="?page=garage&action=repair&id={id}">Repair</a>
</td>
</tr>
{/each}
{/each}
</tbody>