my blog link dont give me a slug (i guess because of the / at the end).
so i found a workaround for me, but i guess ist could be used in generell:
Code: Select all
<?php foreach ($staticContent as $staticPage): ?>
<?php $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
<?php $active = ($actual_link == $staticPage->permalink() or $actual_link == $staticPage->permalink() . '/')? 'active': ''; ?>
<a class="<?php echo $active; ?>" href="<?php echo $staticPage->permalink(); ?>"><?php echo $staticPage->title(); ?></a>
<?php endforeach ?>
First i check the actual link / url - http/https can both be set:
Code: Select all
<?php $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
Code: Select all
<?php $active = ($actual_link == $staticPage->permalink() or $actual_link == $staticPage->permalink() . '/')? 'active': ''; ?>
So the main problem ist, that the slug didnt gave me something back, when i clicked on the "blog" link.