Okay, basically, I'm trying to build a navigation tree out of several different arrays. One array holds information about each category, such as name, a second name to reference, and the array which holds the links for each section:
$navcategories = array (
// Categories
'general' => array ('General', 'general', $navgeneral),
'reviews' => array ('Reviews', 'reviews', $navreviews),
'animemanga' => array ('Anime/Manga', 'animemanga', $navanime),
'gaming' => array ('Gaming', 'gaming', $navgaming),
'misc' => array ('Miscellaneous', 'misc', $navmisc)
);
So, basically it references another array. However, I'm having trouble calling the second array. I'm trying to do it like so:
foreach ($navcategories as $cat) {
print ('
<li class="navcat"><div class="navcat">' . $cat[0] . '</div></li>
');
foreach ($cat[2] as $link) {
print ('
<li class="navlink"><div class="navblock"></div><div class="navlink"><a href="index.php?tare=' . $link[0] . '" class="nav">' . key($link) . '</a></div></li>
');
};
print ('
<br />
');
};
The error I'm getting is:
Warning: Invalid argument supplied for foreach() in /home/ketsuka/public_html/frozensky/Themes/v1/Template.Index.php on line 48
Line 48 is:
foreach ($cat[2] as $link) {