[eluser]Lone[/eluser]
This is a quick and dirty way to do it - your best way is to get the $items compiled from a DB (using a model) of some sorts using similar field names.
Code:
function build_menu($uri)
{
$items = array();
$items[0]['url'] = '';
$items[0]['title'] = 'home';
$items[0]['name'] = 'Home';
$items[1]['url'] = 'blotter';
$items[1]['title'] = 'blotter';
$items[1]['name'] = 'TechBlotter';
$items[2]['url'] = 'devblog';
$items[2]['title'] = 'blog';
$items[2]['name'] = 'DevBlog';
$menu = '<ul>'."\n";
foreach($items as $item) {
if(stristr($item['url'], $uri)) {
$class = ' class="current"';
} else {
$class = '';
}
$menu .= "\t".'<li><a href="/'.$item['url'].'"'.$class.' title="'.$item['title'].'"><span>'.$item['name'].'</span></a></li>'."\n";
}
$menu .= '</ul>';
return $menu;
}
The "/n" and "/t" aren't really required but I like html
EDIT: You just must have edited yours with the solution after I posted! They way you built your array is the best way for just two vars, but I do have a habit at times of preferring a numbered index