I use the following code in my page.tpl.php of a Drupal 7 installation:
if (!path_is_admin(current_path())) {
$pathArray = explode('/', current_path());
if (!empty($pathArray)) {
$path_to_node = url("node/".$pathArray[1]);
$menuChildArray = explode('/', $path_to_node);
$menuParent = $menuChildArray[2];
}
}
But on some pages in the admin interface, I get:
Notice: Undefined offset: 2 in include() (line 36 of /home/www/doc/7622/s-d-d.de/testkc/sites/all/themes/sdd2015/page.tpl.php).
The code should only be executed if I am on the frontend...? Why does it get fired in the backend?