forked from I2P_Developers/i2p.www
read navigation from menu.ini
(duck)
This commit is contained in:
65
menu.php
65
menu.php
@@ -1,41 +1,38 @@
|
||||
<?php
|
||||
// TODO: improve this, like include the navigation hierarchy into it
|
||||
|
||||
// dictionary for looking up the page title, if there is no match
|
||||
// the first character of the page is capitalized
|
||||
$pagetitles = array('home' => 'News',
|
||||
'about' => 'About I2P',
|
||||
'getinvolved' => 'Get involved',
|
||||
'halloffame' => 'Hall of Fame',
|
||||
'myi2p' => 'MyI2P',
|
||||
'minwww' => 'MinWWW',
|
||||
'i2ptunnel' => 'I2PTunnel',
|
||||
'i2ptunnel_services' => 'Setting up services',
|
||||
'i2ptunnel_tuning' => 'Tuning',
|
||||
'i2ptunnel_lan' => 'LAN setup',
|
||||
'jvm' => 'JVM',
|
||||
'api' => 'API',
|
||||
'sam' => 'SAM',
|
||||
'i2cp' => 'I2CP',
|
||||
'how' => 'How does it work?',
|
||||
'how_intro' => 'Intro',
|
||||
'how_threatmodel' => 'Threat model',
|
||||
'how_tunnelrouting' => 'Tunnel routing',
|
||||
'how_garlicrouting' => 'Garlic routing',
|
||||
'how_networkdatabase' => 'Network database',
|
||||
'how_peerselection' => 'Peer selection',
|
||||
'how_cryptography' => 'Cryptography',
|
||||
'how_elgamalaes' => 'ElGamal/AES+SessionTag',
|
||||
'how_networkcomparisons' => 'Network comparisons',
|
||||
'faq' => 'FAQ',
|
||||
'cvs' => 'CVS');
|
||||
|
||||
function getpagetitle($page) {
|
||||
global $pagetitles;
|
||||
if (isset($pagetitles[$page])) {
|
||||
return $pagetitles[$page];
|
||||
global $site_structure;
|
||||
if (isset($site_structure[$page]['title'])) {
|
||||
return $site_structure[$page]['title'];
|
||||
}
|
||||
$title = str_replace ('_', ' ', $page);
|
||||
return ucfirst($title);
|
||||
}
|
||||
|
||||
function buildmenu() {
|
||||
global $site_structure;
|
||||
foreach ($site_structure as $page=>$page_config) {
|
||||
if (isset($page_config['depth'])) {
|
||||
$title = getpagetitle($page);
|
||||
$link = '';
|
||||
if (isset($page_config['link'])) {
|
||||
$link = $page_config['link'];
|
||||
} else {
|
||||
$link = $page;
|
||||
}
|
||||
switch ($page_config['depth']) {
|
||||
case 1:
|
||||
print "<br /><b><a href=\"$link\">$title</a></b><br />\n";
|
||||
break;
|
||||
case 2:
|
||||
print "- <a href=\"$link\">$title</a><br />\n";
|
||||
break;
|
||||
case 3:
|
||||
print " * <a href=\"$link\">$title</a><br />\n";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user