/**
  * creates the effect of a symlink and allows the passing of data (keys of $data)
  * to the included page to mimic the directory contents of $path
  *
  *     $p->inherit('includes/somepath');
  *
  * @param  string  $path
  * @param  array   $data     associative
  * @throws PageException
  */
 public function inherit($path, $data = array())
 {
     // add first slash if it isn't there so exploding is accurate.
     $path = strpos($path, '/') !== 0 ? '/' . $path : $path;
     global $codebase_path_arr, $db;
     $router = new \Sky\PageRouter(array('codebase_paths' => $codebase_path_arr, 'db' => $db));
     $qs = array_merge(explode('/', $path), $this->queryfolders);
     $router->checkPath($qs);
     $inherited_path = end($router->page_path);
     if (!$inherited_path) {
         throw new PageException('Page::inherit could not find this path. ' . $path);
     }
     // set variables
     $this->inherited_path = $inherited_path;
     $this->vars = array_merge($this->vars, $router->vars);
     $this->setAssetsByPath($this->inherited_path);
     $this->incpath = static::getIncPath($this->inherited_path);
     // need to set path for queryfolders to work properly
     $slug = static::getPathSlug($this->inherited_path);
     $qf = $this->queryfolders;
     $key = array_search($filename, $qf);
     $key = is_bool($key) ? 0 : $key + 1;
     $this->queryfolders = array_slice($qf, $key);
     // call this in a closure so that
     // the inherited page does not have any previously declared vars
     $this->includePath($this->inherited_path, $data);
 }