<ul> | |||||
<repeat group="{{ @menu }}" key="{{ @key }}" value="{{ @item }}"> | |||||
<li class="away"> | |||||
<a href="{{ @item.href }}" class="nav-{{ @key }}">{{ @item.name }}</a> | |||||
</li> | |||||
</repeat> | |||||
</ul> |
<check if="{{ @menuAddHome }}"> | |||||
<a class="home-link" href="{{ @SITE_URL }}/{{ (@LANG=='de' ? '' : '?lang='.@LANG )}}">HOME</a> | |||||
</check> | |||||
<ul> | |||||
<ul> | |||||
<repeat group="{{ @menu }}" key="{{ @key }}" value="{{ @item }}"> | <repeat group="{{ @menu }}" key="{{ @key }}" value="{{ @item }}"> | ||||
<check if="{{ is_array(@item) }}"> | |||||
<true> | |||||
<li class="{{ in_array(@key,$url)?'active':'away' }}"> | |||||
<a href="{{ @SITE_URL }}/{{ @key }}{{ (@LANG=='de' ? '' : '?lang='.@LANG )}}">{{ @item.index }}</a> | |||||
<li><a href="{{ @item.href }}" >{{ @item.name }}</a> | |||||
<check if="{{ is_array(@item.submenu) }}"> | |||||
<include href="navigation.htm" with="menu={{ @item.submenu }}" /> | |||||
</check> | |||||
</li> | |||||
</repeat> | |||||
</ul> | |||||
<check if="{{ false }}"> | |||||
<ul> | |||||
<repeat group="{{ @menu }}" key="{{ @key }}" value="{{ @item }}"> | |||||
<check if="{{ is_array(@item) }}"> | |||||
<true> | |||||
<li class="{{ in_array(@key,$url)?'active':'away' }}"> | |||||
<a href="{{ @SITE_URL }}/{{ @key }}{{ (@LANG=='de' ? '' : '?lang='.@LANG )}}">{{ @item.index }}</a> | |||||
<check if="{{ count(@item) > 1 }}"> | <check if="{{ count(@item) > 1 }}"> | ||||
<ul> | <ul> | ||||
</ul> | </ul> | ||||
</check> | </check> | ||||
</li> | |||||
</true> | |||||
<false> | |||||
<li class="{{ in_array(@key,$url)?'active':'away' }}"> | |||||
<a href="{{ @SITE_URL }}/{{ @key }}{{ (@LANG=='de' ? '' : '?lang='.@LANG )}}">{{ @item }}</a> | |||||
</li> | |||||
</false> | |||||
</check> | |||||
</repeat> | |||||
</ul> | |||||
</li> | |||||
</true> | |||||
<false> | |||||
<li class="{{ in_array(@key,$url)?'active':'away' }}"> | |||||
<a href="{{ @SITE_URL }}/{{ @key }}{{ (@LANG=='de' ? '' : '?lang='.@LANG )}}">{{ @item }}</a> | |||||
</li> | |||||
</false> | |||||
</check> | |||||
</repeat> | |||||
</ul> | |||||
</check> |
<!doctype html> | <!doctype html> | ||||
<html> | |||||
<html lang="{{ @LANG }}"> | |||||
<head> | <head> | ||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" /> | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> | ||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||||
<meta content="noindex, nofollow" name="robots"> | |||||
<check if="{{ @hideFromSearchEngines }}"> | |||||
<meta name="robots" content="noindex, nofollow"> | |||||
</check> | |||||
<meta name="viewport" content="width=device-width, initial-scale=1"> | <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
<link rel="icon" href="/rsc/img/favicon OFS.png" /> | |||||
<link rel="icon" href="/{{ @RESOURCES }}favicon.png" /> | |||||
<link href="/rsc/featherlight.min.css" type="text/css" rel="stylesheet" /> | |||||
<link href="/{{ @RESOURCES }}featherlight.min.css" type="text/css" rel="stylesheet" /> | |||||
<script type="text/javascript" src="/{{ @RESOURCES }}jquery-3.3.1.min.js"></script> | <script type="text/javascript" src="/{{ @RESOURCES }}jquery-3.3.1.min.js"></script> | ||||
<script type="text/javascript" src="/{{ @RESOURCES }}script.js"></script> | <script type="text/javascript" src="/{{ @RESOURCES }}script.js"></script> | ||||
<link type="text/css" href="/{{ @RESOURCES }}style.css" rel="stylesheet" /> | <link type="text/css" href="/{{ @RESOURCES }}style.css" rel="stylesheet" /> | ||||
<title>{{ @title }}</title> | <title>{{ @title }}</title> | ||||
<style> | |||||
li { margin-left:1em; } | |||||
</style> | |||||
</head> | </head> | ||||
<body class="{{ @bodyClass }}"> | <body class="{{ @bodyClass }}"> | ||||
<div id="mobile-nav"> | <div id="mobile-nav"> | ||||
<a class="menu-toggle" onClick="javascript:toggle_menu();"></a> | <a class="menu-toggle" onClick="javascript:toggle_menu();"></a> | ||||
<div class="the_list"> | <div class="the_list"> | ||||
<include href="navigation.htm" /> | |||||
<include href="navigation.htm" with="menu={{ @menu2 }},menuAddHome={{ @menu2AddHome }}" /> | |||||
<include href="navigation.htm" with="menu={{ @navi.main }}" /> | |||||
<include href="navigation.htm" with="menu={{ @navi.footer }}" /> | |||||
<include href="nav-external.htm" with="menu={{ @navi.languages }}" /> | <include href="nav-external.htm" with="menu={{ @navi.languages }}" /> | ||||
</div> | </div> | ||||
</div> | |||||
</div> <!-- #mobile-nav --> | |||||
<div id="page-wrap"> | <div id="page-wrap"> | ||||
</header> | </header> | ||||
<nav id="main-nav"> | <nav id="main-nav"> | ||||
<include href="navigation.htm" /> | |||||
<include href="navigation.htm" with="menu={{ @navi.main }}" /> | |||||
<div class="network"> | <div class="network"> | ||||
<include href="nav-external.htm" with="menu={{ @navi.network }},menuAddHome={{ @navi.network._config.addHome }}"> | |||||
<include href="navigation.htm" with="menu={{ @navi.network }}"> | |||||
</div> | </div> | ||||
</nav> | </nav> | ||||
<footer id="main-footer"> | <footer id="main-footer"> | ||||
<nav> | <nav> | ||||
<include href="navigation.htm" with="menu={{ @menu2 }},menuAddHome={{ @menu2AddHome }}" /> | |||||
<include href="navigation.htm" with="menu={{ @navi.footer }}" /> | |||||
</nav> | </nav> | ||||
<nav id="languages"> | <nav id="languages"> | ||||
<include href="nav-external.htm" with="menu={{ @navi.languages }}" /> | <include href="nav-external.htm" with="menu={{ @navi.languages }}" /> | ||||
</nav> | </nav> | ||||
</footer> | </footer> | ||||
</div> | |||||
</div> <!-- #page-wrap --> | |||||
<check if="{{ @backend }}"> | <check if="{{ @backend }}"> | ||||
<div id="admin-panel">{{ @backend | raw }}</div> | <div id="admin-panel">{{ @backend | raw }}</div> |
} | } | ||||
$f3->set('CONTENT', $content_dir); | $f3->set('CONTENT', $content_dir); | ||||
// set menu | |||||
if(array_key_exists($f3->get('LANG'), $f3->get('nav.main'))) { | |||||
$menu=$f3->get('nav.main.'.$f3->get('LANG')); | |||||
} else { | |||||
$menu=$f3->get('nav.main.'.$f3->get('default_lang')); | |||||
} | |||||
$f3->set('menuAddHome',$f3->get('nav.main.config.addHome')); | |||||
$f3->set('menu', $menu); | |||||
// set menu2 | |||||
if(array_key_exists($f3->get('LANG'), $f3->get('nav.footer'))) { | |||||
$menu=$f3->get('nav.footer.'.$f3->get('LANG')); | |||||
} else { | |||||
$menu=$f3->get('nav.footer.'.$f3->get('default_lang')); | |||||
} | |||||
$f3->set('menu2AddHome',$f3->get('nav.footer.config.addHome')); | |||||
$f3->set('menu2', $menu); | |||||
if(array_key_exists($f3->get('LANG'), $f3->get('nav.network'))) { | |||||
$menu=$f3->get('nav.network.'.$f3->get('LANG')); | |||||
} else { | |||||
$menu=$f3->get('nav.network.'.$f3->get('default_lang')); | |||||
} | |||||
if(is_array($menu)) { | |||||
foreach($menu as $k=>$v) { | |||||
$ex = explode(": ", $menu[$k]); | |||||
$menu[$k] = array( | |||||
'name' => trim($ex[0]), | |||||
'href' => count($ex) > 1 ? $ex[1] : $ex | |||||
); | |||||
function menu_recursion($m,$root="") { | |||||
$f3 = \Base::instance(); | |||||
$out=[]; | |||||
foreach ($m as $key=>$value) { | |||||
$folder = $key == "index" ? "" : "/".$key; | |||||
$path = $root.$folder; | |||||
if (is_array($value)) { | |||||
$submenu=menu_recursion($value,$path); | |||||
$out[$path]=$submenu[$path]; | |||||
unset($submenu[$path]); | |||||
$out[$path]['submenu']=$submenu; | |||||
} else { | |||||
$ex = explode(":=", $value); | |||||
if (count($ex) > 1) { | |||||
# external link | |||||
$href = $ex[1]; | |||||
} else { | |||||
# internal link | |||||
$href = $f3->get('SITE_URL').$path; | |||||
} | |||||
$out[$path]['name']=$ex[0]; | |||||
$out[$path]['href']=$href; | |||||
//print($path." - ".$ex[0]." - ".$href."<br>"); | |||||
} | |||||
} | } | ||||
return $out; | |||||
} | } | ||||
$f3->set('navi.network._config.addHome', $f3->get('nav.network.config.addHome')); | |||||
$f3->set('navi.network', $menu); | |||||
function read_menu($menu_name) { | |||||
$f3 = \Base::instance(); | |||||
if(array_key_exists($f3->get('LANG'), $f3->get('nav.'.$menu_name))) { | |||||
$menu=$f3->get('nav.'.$menu_name.'.'.$f3->get('LANG')); | |||||
} else { | |||||
$menu=$f3->get('nav.'.$menu_name.'.'.$f3->get('default_lang')); | |||||
} | |||||
if(array_key_exists($f3->get('LANG'), $f3->get('nav.languages'))) { | |||||
$menu=$f3->get('nav.languages.'.$f3->get('LANG')); | |||||
} else { | |||||
$menu=$f3->get('nav.languages.'.$f3->get('default_lang')); | |||||
} | |||||
if(is_array($menu)){ | |||||
foreach($menu as $k=>$v) { | |||||
$ex = explode(": ", $menu[$k]); | |||||
$menu[$k] = array( | |||||
'name' => trim($ex[0]), | |||||
'href' => count($ex) > 1 ? $ex[1] : $ex | |||||
); | |||||
if (is_array($menu)) { | |||||
//var_dump($menu); | |||||
//print("<br>"); | |||||
$menu=menu_recursion($menu); | |||||
} | } | ||||
$f3->set('navi.languages._config.addHome', $f3->get('nav.languages.config.addHome')); | |||||
$f3->set('navi.languages', $menu); | |||||
$f3->set('navi.'.$menu_name, $menu); | |||||
//var_dump($f3->get('navi.'.$menu_name)); | |||||
//print("<br>"); | |||||
} | } | ||||
read_menu("main"); | |||||
read_menu("footer"); | |||||
read_menu("network"); | |||||
read_menu("languages"); | |||||
// this is needed so the menu can compare the current page with a link to it | // this is needed so the menu can compare the current page with a link to it | ||||
// and use this information to determine the active state | // and use this information to determine the active state |