本文整理匯總了PHP中router::render_view方法的典型用法代碼示例。如果您正苦於以下問題:PHP router::render_view方法的具體用法?PHP router::render_view怎麽用?PHP router::render_view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類router
的用法示例。
在下文中一共展示了router::render_view方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: perform_controller_action
static function perform_controller_action($class_path, $action, $objects, $parameters)
{
//We treat 'new' the same as 'edit', since they generally contain a lot of the same code
if ($action == "new") {
$action = "edit";
}
//Let's look for a controller
$controller_path = SITE_PATH . "/controllers/" . $class_path . "_controller.php";
if (file_exists($controller_path)) {
require_once $controller_path;
$class_path_components = explode("/", $class_path);
$class = $class_path_components[count($class_path_components) - 1];
$controller_class = $class . "_controller";
if (!method_exists($controller_class, $action)) {
if (router::render_view($class_path, $action)) {
exit;
} else {
fatal_error("{$controller_class} does not respond to {$action}");
}
}
$controller = new $controller_class();
$controller->parameters = $parameters;
call_user_func_array(array($controller, $action), $objects);
exit;
}
//If no controller was found, we'll look for a view
if (router::render_view($class_path, $action)) {
exit;
}
}