Hello!
So, I have this code, but the navbar will not show up. I got an explanation that get_$navbar needs to be put in my index.tpl.php, but in my head that doesn´t look right - the other ones show up, so... Then I also was told that it neds to be put in my config.php, and then he talked about functions.php... I can´t fix it, I don´t get coding. This is my original code, I don´t get what he wants from me.
Help anyone? I would really appreciate it, I´m not asking to cheat really, I have problems with learning some things and this time I got ahead of myself and can´t sort it out.
config.php
(slightly changed to cover my ass )
$sky['navbar'] = array(
'class' => 'nb-plain',
'items' => array(
'home' => array('text'=>'Home', 'url'=>'me.php', 'title' => 'Me'),
'pics' => array('text'=>'Pics', 'url'=>'pics.php', 'title' => 'Pics'),
'source'=> array('text'=>'Source', 'url'=>'source.php', 'title' => 'Source'),
),
'callback_selected' => function($url) {
if(basename($_SERVER['SCRIPT_FILENAME']) == $url) {
return true;
}
}
);
functions.php
function get_navbar($menu) {
$html = "<nav>\n<ul class='{$menu['class']}'>\n";
foreach($menu['items'] as $item) {
$selected = $menu['callback_selected']($item['url']) ? " class='selected' " : null;
$html .= "<li{$selected}><a href='{$item['url']}' title='{$item['title']}'>{$item['text']}</a></li>\n";
}
$html .= "</ul>\n</nav>\n";
return $html;
index.tpl.php
<body>
<div id='wrapper'>
<div id='header'><?=$header?></div>
<div id='navbar'><?=$navbar?></div>
<div id='main'><?=$main?></div>
<div id='footer'><?=$footer?></div>
</div>
</body>