本文整理匯總了PHP中PageController::renderTemplateWithData方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageController::renderTemplateWithData方法的具體用法?PHP PageController::renderTemplateWithData怎麽用?PHP PageController::renderTemplateWithData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PageController
的用法示例。
在下文中一共展示了PageController::renderTemplateWithData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
<?php
$router->with('/', function () use($router) {
$router->respond('GET', '', function ($request, $response) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/routes/page.controller.php';
$page_controller = new PageController();
$page = $page_controller->renderTemplateWithData('/templates/home/home.mustache', null);
echo $page;
});
});
示例2: PageController
require_once $_SERVER['DOCUMENT_ROOT'] . '/routes/page.controller.php';
$page_controller = new PageController();
$page = $page_controller->renderTemplateWithData('/templates/account/create_account.mustache', null);
echo $page;
});
$router->respond('GET', '/get-username', function () {
require_once $_SERVER['DOCUMENT_ROOT'] . '/routes/page.controller.php';
$page_controller = new PageController();
$page = $page_controller->renderTemplateWithData('/templates/account/get_username.mustache', null);
echo $page;
});
$router->respond('GET', '/reset-password', function () {
$data['show_form'] = isset($_GET['v']) ? 1 : 0;
require_once $_SERVER['DOCUMENT_ROOT'] . '/routes/page.controller.php';
$page_controller = new PageController();
$page = $page_controller->renderTemplateWithData('/templates/account/reset_password.mustache', $data);
echo $page;
});
//////////////////////////////////////////////////////////////
//POST
$router->respond('POST', '/new', function () {
require_once __DIR__ . '/account.controller.php';
$account_controller = new AccountController();
$user_name = $_POST['data']['username'];
$email = $_POST['data']['email'];
$password = $_POST['data']['password'];
$account_controller->createAccount($user_name, $email, $password);
});
$router->respond('POST', '/get-username', function () {
});
$router->respond('POST', '/reset-password', function () {