/**
  * Browsing subfolders after a specific file
  * @var string $path
  * @var string $search
  * @return bool
  */
 static function autoSearch($path, $search)
 {
     if (self::$platform == "windows") {
         $seperator = "\\";
         $path = str_replace("/", $seperator, $path);
     } else {
         $seperator = "/";
         $path = str_replace("\\", $seperator, $path);
     }
     $dir = self::$relative_path . $path;
     if (!is_dir($dir)) {
         return false;
     }
     $directoryContent = scandir($dir);
     if (in_array($search, $directoryContent)) {
         self::$searchResult = $path;
         return true;
     } else {
         $hasDirectory = false;
         foreach ($directoryContent as $file) {
             if (is_dir($dir . $file) && $file != "." && $file != "..") {
                 if (!empty(self::$namespaceRange)) {
                     if (in_array($file, self::$namespaceRange)) {
                         $dirs[] = $path . $file;
                         $hasDirectory = true;
                     }
                 } else {
                     $dirs[] = $path . $file;
                     $hasDirectory = true;
                 }
             }
         }
         if ($hasDirectory == true && !empty($dirs)) {
             foreach ($dirs as $directory) {
                 if (self::autoSearch($directory . $seperator, $search) == true) {
                     return true;
                 }
             }
             return false;
         } else {
             return false;
         }
     }
 }
 /**
  * Returns the path to the displayed file
  * @param string $filename
  * @return string
  */
 private function getDisplayPath($filename)
 {
     if (preg_match_all('/(.*)\\.(php|html|phtml)/i', $filename, $result)) {
         if (isset($result[2])) {
             $filename = $result[1][0];
             $extension = "." . $result[2][0];
         } else {
             $extension = ".php";
         }
     } else {
         $extension = ".php";
     }
     PWEL_ROUTING::correctNamespace();
     if (PWEL_ROUTING::$autoSearch == true) {
         if (isset($extension)) {
             $searchname = $filename . $extension;
         } else {
             $searchname = $filename;
         }
         PWEL_ROUTING::autoSearch('app/views/', $searchname);
         PWEL_ROUTING::$searchResult = str_replace('app/views/', '', PWEL_ROUTING::$searchResult);
         $namespace = null;
     } else {
         $namespace = PWEL_ROUTING::$namespace;
     }
     //Set & Correct path
     $path = PWEL_ROUTING::$relative_path . 'app/views/' . PWEL_ROUTING::$searchResult . $namespace . "{$filename}{$extension}";
     return str_replace('//', '/', $path);
 }