I keep getting " Notice: Undefined offset" for this code
<?php
// Detect the subdirectory of the page
$pagePath = getcwd();
$pageDirs = explode("/", $pagePath);
$currentDir = $pageDirs[sizeof($pageDirs)-1];
$isHome = false;
$subDir = null;
if ($currentDir != "public" && $currentDir != "components" && $currentDir != "prototypes" && $currentDir != "styleguide"){
// 2 levels deep in a Pages directory
// Save the last 2 levels into vars
$subDir = $currentDir;
$currentDir = $pageDirs[sizeof($pageDirs)-2];
}
$hostname = getenv('HTTP_HOST');
if ($currentDir == "legacy" || $_SERVER["PHP_SELF"] == "/coronita/index.php"){
// This is the home index page
// No subnav will be needed
$isHome = true;
$currentDir = "overview";
}
?>
the error occur at this line
$currentDir = $pageDirs[sizeof($pageDirs)-2];
Any ideas? This code shows no errors on a mac but on my windows machine I get the error.