本文整理汇总了PHP中Routes::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Routes::getInstance方法的具体用法?PHP Routes::getInstance怎么用?PHP Routes::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Routes
的用法示例。
在下文中一共展示了Routes::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public static function render($path, array $args = array())
{
if (self::$_instance === NULL) {
self::init();
}
$args['request'] = Request::getInstance();
$args['static_url'] = Rivet::getInstance()->config['static_url'];
$template = self::$_instance->twig->loadTemplate($path);
$template->routes = Routes::getInstance();
self::$_instance->body = $template->render($args);
return self::$_instance->body;
}
示例2: dispatch
public function dispatch()
{
if (self::$_instance === NULL) {
self::getInstance();
}
$routes = Routes::getInstance();
$route = $routes->match();
if ($route) {
$view = $route->run();
if ($view instanceof Response) {
self::$_instance->response = $view;
}
// allow returning a response straight from the view
self::$_instance->response = new Response($view);
return self::$_instance->response;
}
return notfound();
}
示例3: reverse
function reverse()
{
$routes = Routes::getInstance();
return $routes->reverse(func_get_args());
}
示例4: __construct
public function __construct($route_name, $params, $lineno)
{
parent::__construct($lineno);
$routes = Routes::getInstance();
$this->url = $routes->reverse(array($route_name, $params));
}
示例5: doRoute
public static function doRoute()
{
$routesInstance = Routes::getInstance();
$routeAction = $routesInstance->getAction();
// make sure we dont show a 404
global $wp_query;
if ($wp_query->is_404) {
$wp_query->is_404 = false;
$wp_query->is_archive = true;
}
header("HTTP/1.0 200 OK");
//header("Content-Type: text/html; charset=UTF-8");
//var_dump($routeAction->action);
//var_dump($routeAction);
if ($routeAction->action['type'] == 'pagename') {
query_posts(array('pagename' => $routeAction->action['name']));
} else {
if ($routeAction->action['type'] == 'filename') {
include TEMPLATEPATH . '/' . $routeAction->action['name'];
exit;
}
}
}
示例6: evaluateRoute
/**
* Evaluate route by given URL
*/
private function evaluateRoute()
{
Routes::getInstance()->loadRoutes()->evaluateURL();
}