mirror of
https://github.com/slawkens/myaac.git
synced 2025-08-23 10:48:31 +02:00
41 lines
660 B
PHP
41 lines
660 B
PHP
<?php
|
|
function get_template_pages($category): array
|
|
{
|
|
global $menus;
|
|
|
|
$ret = array();
|
|
foreach($menus[$category] ?? [] as $menu) {
|
|
$ret[] = $menu['link'];
|
|
}
|
|
|
|
return $ret;
|
|
}
|
|
?>
|
|
let category = '<?php
|
|
if(str_contains(URI, 'subtopic=')) {
|
|
$tmp = [$_REQUEST['subtopic']];
|
|
}
|
|
else {
|
|
$tmp = URI;
|
|
if(empty($tmp)) {
|
|
$tmp = ['news'];
|
|
}
|
|
else {
|
|
$tmp = explode('/', URI);
|
|
}
|
|
}
|
|
|
|
foreach (config('menu_categories') as $id => $info) {
|
|
$templatePages = get_template_pages($id);
|
|
|
|
if ($id == MENU_CATEGORY_ACCOUNT) {
|
|
$templatePages = array_merge($templatePages, ['account']);
|
|
}
|
|
|
|
if (in_array($tmp[0], $templatePages)) {
|
|
echo $info['id'];
|
|
break;
|
|
}
|
|
}
|
|
?>';
|