Router::getPaths PHP Method

getPaths() public static method

Gets path information
public static getPaths ( boolean $current = false ) : array
$current boolean Current parameter, useful when using requestAction
return array
    public static function getPaths($current = false)
    {
        if ($current) {
            return static::$_requests[count(static::$_requests) - 1];
        }
        if (!isset(static::$_requests[0])) {
            return array('base' => null);
        }
        return array('base' => static::$_requests[0]->base);
    }

Usage Example

Example #1
0
 function __construct($method, $messages)
 {
     $this->controller = new AppController();
     $params = Router::getParams();
     $viewPath = $this->controller->viewPath;
     if (Configure::read('App.theme')) {
         $viewPath = 'errors';
         if ($this->controller->view == 'Theme') {
             $viewPath = 'themed' . DS . Configure::read('App.theme') . DS . 'errors';
         }
     }
     if (Configure::read('debug') == 0) {
         $method = 'error404';
     }
     $checkView = VIEWS . $viewPath . DS . Inflector::underscore($method) . '.ctp';
     if (file_exists($checkView)) {
         $this->controller->_set(Router::getPaths());
         $this->controller->viewPath = $viewPath;
         $this->controller->theme = $appConfigurations['theme'];
         $this->controller->pageTitle = __('Error', true);
         $this->controller->set('message', $messages[0]['url']);
         $this->controller->set('appConfigurations', $appConfigurations);
         $this->controller->render($method);
         e($this->controller->output);
     } else {
         parent::__construct($method, $messages);
     }
 }
All Usage Examples Of Router::getPaths