I've trying to iterate the following array of PHP inside and HTML template:
$sub_menu = array(
array(
'titulo' => 'Ropa',
'url' => '/ropa.html
'),
array(
'titulo' =>'Electronica',
'url' => '/electronica.html'
),
array(
'titulo' => 'Higiene',
'url' =>'/higiene.html'
),
array(
'titulo' => 'Alimentos',
'url' => '/alimentos.html'
),
array(
'titulo' => 'Otros',
'url' => '/otros.html'
)
);
Hadn't been lucky so far. What I'm trying to do is to show this as a list inside of a nav tag.
Could you please lend me a hand?
So I tried this
<?php
echo '<ul>';
foreach ($sub_menu as $parent) {
if (is_array($parent)) {
echo '<ul>';
foreach ($parent as $children => $key) {
echo '<li><a href="#">' . $children . '</a>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul>';
?>