本文整理汇总了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 () {