Test empty var

This commit is contained in:
Knah Tsaeb 2024-12-03 16:56:41 +01:00
parent 6bafa8f0e6
commit 2aa3bce5f7

View file

@ -6,11 +6,11 @@ class Selected {
static function selected($var, $ref) { static function selected($var, $ref) {
$testPostsPage = explode('/', $ref); $testPostsPage = explode('/', $ref);
if ($testPostsPage[1] === 'post') { if (isset($testPostsPage[1]) && $testPostsPage[1] === 'post') {
$ref = '/posts'; $ref = '/posts';
} }
if ($var === $ref) { if ($var === $ref) {
return 'active'; return 'active';
} }
} }
} }