set-nav.php

File Type: php File Location: monofiles/ File name: set-nav.php
<?php
        
    
function load_navigation($cur NULL)    {
        
        global 
$rot;
        include 
$rot.'monofiles/display-order.php';
        
        
$nav display_order($rot.'monofiles/filesinfo/navigation.xml');
        
        if (
$nav !== false){
        
        
//container    
        
print '<nav id="main-nav">'.PHP_EOL.'<ul>';
        
            foreach(
$nav as $item) {
                
                
//menu items
                
$tar = ($item->tar=='checked') ? ' target="_blank"' '';

                echo 
'<li><a class="nav" href="'.$item->url.'"'.$tar.' title="'.$item->title.'">'.$item->title.'</a>';
                
// submenu items depending on file existance
                
if (is_file($rot.'monofiles/filesinfo/'.$item->id.'.xml')) {

                    
$sub display_order($rot.'monofiles/filesinfo/'.$item->id.'.xml');

                    if (
$sub !== false)
                        print 
'<ul>';
                        foreach(
$sub as $subitem){
                            
$tar = ($subitem->tar=='checked') ? ' target="_blank"' '';
                            echo 
'<li><a href="'.$subitem->url.'"'.$tar.' title="'.$subitem->title.'">'.$subitem->title.'</a></li>';
                        }
                        print 
'</ul>';
                }
                print 
'</li>';
            }
            
        print 
'</ul>'.PHP_EOL.'</nav>';
        }
    }
    
?>