forked from Adleraci/adlerka.top
test
This commit is contained in:
parent
53d3c1be54
commit
56b338e65f
@ -59,7 +59,7 @@ else{
|
|||||||
$page = file_get_contents($template_dir . "404.html");
|
$page = file_get_contents($template_dir . "404.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
$navpages = include_once $template_dir . "navpages.php";
|
$navpages = generateNavigation($static_page_dir, $protocol, $subdomain, $domain, $tld, $default_page, $page_name);
|
||||||
|
|
||||||
$nav = str_replace("__NAV_PAGES__", $navpages, $nav);
|
$nav = str_replace("__NAV_PAGES__", $navpages, $nav);
|
||||||
|
|
||||||
|
@ -1,39 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$navsite_template = '<li class="navsite_item"><a href="__LOCATION__" __CLASS__>__NAME__</a><ul class="navpage_list">__NAVPAGES__</ul></li>';
|
function generateNavigation($static_page_dir, $protocol, $subdomain, $domain, $tld, $default_page, $page_name)
|
||||||
$navpage_template = '<li class="navpage_item"><a href="__LOCATION__" __CLASS__>__NAME__</a></li>';
|
{
|
||||||
|
$navsite_template = '<li class="navsite_item"><a href="__LOCATION__" __CLASS__>__NAME__</a><ul class="navpage_list">__NAVPAGES__</ul></li>';
|
||||||
|
$navpage_template = '<li class="navpage_item"><a href="__LOCATION__" __CLASS__>__NAME__</a></li>';
|
||||||
|
|
||||||
|
$site_dirs = array_diff(scandir($static_page_dir), array('.', '..'));
|
||||||
|
|
||||||
$site_dirs = array_diff(scandir($static_page_dir), array('.', '..'));
|
$nav_out = "";
|
||||||
|
|
||||||
$nav_out = "";
|
foreach ($site_dirs as $site_dir) {
|
||||||
|
|
||||||
foreach($site_dirs as $site_dir){
|
|
||||||
$pages_dir = array_diff(scandir("$static_page_dir$site_dir"), array('.', '..'));
|
$pages_dir = array_diff(scandir("$static_page_dir$site_dir"), array('.', '..'));
|
||||||
|
|
||||||
$navsite = $navsite_template;
|
$navsite = $navsite_template;
|
||||||
$site_class = "class=\"navsite_link\"";
|
$site_class = "class=\"navsite_link\"";
|
||||||
$site_name = str_replace("_", " ", $site_dir);
|
$site_name = str_replace("_", " ", $site_dir);
|
||||||
if($site_name == "global"){
|
if ($site_name == "global") {
|
||||||
$site_name = "misc";
|
$site_name = "misc";
|
||||||
$site_dir = $default_site;
|
$site_dir = $default_page;
|
||||||
}
|
}
|
||||||
$site_location = "$protocol$site_dir.$domain.$tld/$default_page";
|
$site_location = "$protocol$site_dir.$domain.$tld/$default_page";
|
||||||
$navsite = str_replace("__CLASS__", $site_class, $navsite);
|
$navsite = str_replace("__CLASS__", $site_class, $navsite);
|
||||||
$navsite = str_replace("__LOCATION__", $site_location, $navsite);
|
$navsite = str_replace("__LOCATION__", $site_location, $navsite);
|
||||||
$navsite = str_replace("__NAME__", $site_name, $navsite);
|
$navsite = str_replace("__NAME__", $site_name, $navsite);
|
||||||
|
|
||||||
if($subdomain == $site_dir){
|
if ($subdomain == $site_dir) {
|
||||||
//this is the current page
|
//this is the current page
|
||||||
$site_class = "class=\"navsite_link active\"";
|
$site_class = "class=\"navsite_link active\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
$navpages = "";
|
$navpages = "";
|
||||||
foreach($pages_dir as $page_dir){
|
foreach ($pages_dir as $page_dir) {
|
||||||
$page_dir = explode(".", $page_dir)[0];
|
$page_dir = explode(".", $page_dir)[0];
|
||||||
$navpage = $navpage_template;
|
$navpage = $navpage_template;
|
||||||
$page_class = "class=\"navpage_link\"";
|
$page_class = "class=\"navpage_link\"";
|
||||||
if($subdomain == $site_dir && $page_name == $page_dir){
|
if ($subdomain == $site_dir && $page_name == $page_dir) {
|
||||||
$page_class = "class=\"navpage_link active\"";
|
$page_class = "class=\"navpage_link active\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +50,9 @@ foreach($site_dirs as $site_dir){
|
|||||||
}
|
}
|
||||||
$navsite = str_replace("__NAVPAGES__", $navpages, $navsite);
|
$navsite = str_replace("__NAVPAGES__", $navpages, $navsite);
|
||||||
$nav_out .= $navsite;
|
$nav_out .= $navsite;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nav_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nav_out;
|
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user