i have an index.php page in each directory, and each one has several required files. These pages start like this:
<?php
//about index
/*menu.php comprises all of the menus used in the site in arrays. Edit the array to change the menu*/
require('..//menu.php');
/*functions.php defines how the content is gathered and presented*/
require('..//functions.php');
Here is the function that displays the menu:
//populates the menu with the menu array included in the file "menu.php".
function menuPrint($menu){
for($row = 0; $row < count($menu); $row++){
$j = 0;
while(list($key, $value) = each($menu[$row])){
if ($j == 0){
echo '<table class="menutable"><tr><td class="'.$j.'"><a href='.$value.'>'.$key.'</a></td></tr>';
$j = 1;
}else{//closes if
echo'<tr><td class="'.$j.'"><a href='.$value.'>'.$key.'</a></td></tr>';
}//closes else
}//closes while
echo '</table>';
}//closes for
}
Here is the array:
$menu = array(
array('What\'s New'=>'http://www.dio.org/news/index.php?title=Diocesan News&office=aboutMenu',
'Legislative Activities'=>'http://www.dio.org/legislative/index.php?file=home',
'Job Opportunities'=>'http://www.dio.org/employment/index.php?file=home',
'Upcoming Events'=>'http://www.dio.org/news/index.php?title=Upcoming Events&office=aboutMenu',
'Story of the Day'=>'http://www.dio.org/catholictimes/cnsstory.php',
'CNS Movie Review'=>'http://www.dio.org/catholictimes/cnsmovie.php'),
This is only a small portion of the array. You can see it at http://www.dio.org , it's the menu down the left. The problem that prompted this is that when I add one more element to an array, it ceases to work. Is there a better way to read elements of an array into a function?