I'm learning how PHP works, but at the same time I have to redesign an custom CMS.
CMS is written in PHP, I have restyled the default menu using CSS and added a side slide effect. But now, I need to keep this side panel opened, when I click on a link from the menu. I think, the easiest way is prevent page reload = to make menu links open in a page content section (<div id="content"></div>). But because in a source code, there are lots of functions, variables etc., I really need your help, how to proceed.
/Admin/index.php - content from menu sections (placed in separate files) is called here using a function
AdminLib/CSS/style.css - contains also styles for side menu
AdminLib/Include/menu.php - here is defined a side menu (ul, li)
/Admin/index.php
...
...
...
<body>
<?php if ($page != 'login') { 
    $menu_obj = new AdminMenu(dirname(__FILE__).'/Tabdefs/');
    echo $menu_obj->GetHtml();
?>
    <div class="site-wrap">
<?php
    }
    ContContent();
?>
    </div>
...
...
...
AdminLib/Include/menu.php
...
...
...
//vrati html pro svoje menu
public function GetHtml() {
$html = '<ul class="navigation">';
$html .= $this->GetHtmlRecursive($this->menu_def);
$html .= '</ul>';
$html .= '<input type="checkbox" id="nav-trigger" class="nav-trigger" /><label for="nav-trigger"></label>';
return $html;
}
/********** PRIVATE ***********/
//vrati html pro vsechny polozky menu v poli $arr; Pokud tam nejaka ma sub, tak se vola rekurzivne
private function GetHtmlRecursive($arr) {
    $html = '';
    foreach ($arr AS $item) {
        //neukazovane polozky rovnou preskakuju
        if ($item['show'] != 'Y')   
            continue;
    //ted jestli mam podpolozky, tak rekurzujeme    
    if (isset($item['sub'])) {
        $html .= '<li class="nav-item"><a href="#">'.$item['nazev'].'</a>'.
            '<ul class="nav-item">';
        $html .= $this->GetHtmlRecursive($item['sub']);
        $html .= '</ul></li>';
    }
    else {
         //pokud podpolozky nemam, tak vypisu normalni polozku
        $html .= '<li class="nav-item"><a href="'.$item['url'].'">'.$item['nazev'].'</a></li>';
    }
} //foreach pres polozky $arr
return $html;
}
...
...
...
I trying to integrate something like this - using jQuery script (How to target the href to div - 2nd and 3rd link on JsFiddle) into my source code, but I need help with realisation - I wasn't able to make it working.
 
     
    