adlerka.space/templates/navpages.php

26 lines
747 B
PHP
Raw Normal View History

2024-01-11 10:14:21 +01:00
<?php
2024-01-11 10:28:00 +01:00
ob_start();
2024-01-11 10:14:21 +01:00
2024-01-11 10:28:00 +01:00
$navsite_template = '<li><a class="navsite_link" href="__LOCATION__" __CLASS__>__NAME__</a><ul class="navpage_list"></ul></li>';
$navpage_template = '<li><a class="navpage_link" href="__LOCATION__" __CLASS__>__NAME__</a></li>';
2024-01-11 10:14:21 +01:00
2024-01-11 10:21:06 +01:00
$page_dir = "pages";
2024-01-11 10:14:21 +01:00
2024-01-11 10:28:00 +01:00
$site_dirs = array_diff(scandir($page_dir), array('.', '..'));
2024-01-11 10:14:21 +01:00
2024-01-11 10:28:00 +01:00
$domain = basename(explode('.', $_SERVER['HTTP_HOST'])[1]);
$tld = basename(explode('.', $_SERVER['HTTP_HOST'])[2]);
2024-01-11 10:14:21 +01:00
2024-01-11 10:28:00 +01:00
foreach($site_dirs as $site_dir){
$pages_dir = array_diff(scandir("$page_dir/$site_dir"), array('.', '..'));
$navpages = "";
foreach($pages_dir as $page_dir){
$navpage = $navpage_template;
$navpage =
$navpages .= $navpage;
}
}
return ob_get_clean();
2024-01-11 10:14:21 +01:00
?>