本文整理汇总了PHP中Slim\Slim::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::render方法的具体用法?PHP Slim::render怎么用?PHP Slim::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Slim
的用法示例。
在下文中一共展示了Slim::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($msg = null)
{
$data = [];
if (!is_null($msg)) {
$data['message'] = $msg;
}
$this->slim->render('login.twig', $data);
}
示例2: render
protected function render($template, $data = array(), $status = null)
{
try {
$this->application->render($template, $data, $status);
} catch (Twig_Error_Runtime $e) {
$this->application->render('Error/app_load_error.html.twig', array('message' => sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e));
}
}
示例3: registrationRoute
public static function registrationRoute(\Slim\Slim $app)
{
$app->get('/', function () use($app) {
$app->render('index.php');
});
$app->post('/form/', function () use($app) {
$app->render('index.php', ['nickname' => $_POST['nickname']]);
});
}
示例4: delete
public function delete($key)
{
$config = new Config();
if ($config->readKey($key)) {
$id = $config->id;
$this->app->render($config->delete() ? 200 : 500, ['response' => $id]);
} else {
$this->app->render(404);
}
}
示例5: getFeedItemsAtom
/**
* GET /export/feed/:id/atom
*
* @param int $id
*/
public function getFeedItemsAtom($id)
{
$feed = new Feed();
if (!$feed->read($id)) {
$this->app->render(404);
return;
}
$items = (new Item())->readList('id_feed = ?', [$feed->id]);
$this->xmlOutput(new Atom($feed, $items));
}
示例6: render
protected function render($template, $data = array(), $status = array())
{
try {
$this->app->render($template, $data, $status);
} catch (Twig_Error_Runtime $twigException) {
$errorData = array();
$errorData['errorMessage'] = sprintf("An error was thrown while rendering view template from class %s. (%s)", get_class($this), $twigException->getMessage());
if ($this->app->getMode() == self::DEV_MODE) {
$errorData['stackTrace'] = $twigException->getTraceAsString();
}
$this->app->render(self::ERROR_TEMPLATE, $errorData, self::ERROR_CODE);
}
}
示例7: cleanupOldFiles
public function cleanupOldFiles()
{
$_SESSION['DB_DONE'] = true;
$cleanupList = array_merge($this->pluginFinder->getDummyPlugins(), $this->filesFinder->getCleanupFiles());
$this->cleanupMedia();
if (count($cleanupList) == 0) {
$_SESSION['CLEANUP_DONE'] = true;
$this->response->redirect($this->app->urlFor('done'));
}
if ($this->request->isPost()) {
$result = [];
foreach ($cleanupList as $path) {
$result = array_merge($result, Utils::cleanPath($path));
}
if (count($result) == 0) {
$_SESSION['CLEANUP_DONE'] = true;
$this->response->redirect($this->app->urlFor('done'));
} else {
$result = array_map(function ($path) {
return substr($path, strlen(SW_PATH) + 1);
}, $result);
$this->app->render('cleanup.php', ['cleanupList' => $result, 'error' => true]);
}
} else {
$cleanupList = array_map(function ($path) {
return substr($path, strlen(SW_PATH) + 1);
}, $cleanupList);
$this->app->render('cleanup.php', ['cleanupList' => $cleanupList, 'error' => false]);
}
}
示例8: render
/**
* Override \Slim\Slim::render method on controller
*
* @param string $tpl
* @param array $data []
* @param string $suffix
* @return void
*/
protected function render($tpl, array $data = [])
{
$suffix = $this->app->config('template.suffix');
$suffix = empty($suffix) ? $this->viewSuffix : $suffix;
$tpl .= $suffix;
$this->app->render($tpl, $data);
}
示例9: render
public function render($name, $data = array(), $status = null)
{
if (strpos($name, ".php") === false) {
$name = $name . ".php";
}
parent::render($name, $data, $status);
}
示例10: printMenu
/**
*
*/
public function printMenu()
{
$result = [];
$complete = true;
$entries = $this->entries;
foreach ($entries as $entry) {
$active = $entry == current($this->entries);
if ($active) {
$complete = false;
}
$key = 'menuitem_' . $entry;
$label = $this->translations->translate($key);
$result[] = ['label' => $label, 'complete' => $complete, 'active' => $active];
}
$this->slim->render('/_menu.php', ['entries' => $result]);
}
示例11: action_quickAddDialog
/**
* Returns the form HTML to create a new setup.
* @param Slim $app
*/
public function action_quickAddDialog(Slim $app)
{
if (!$app->user->isLoggedin()) {
return false;
}
$tour = $app->rulechecker->getTournament();
$app->render('setup/quickAddDialog.twig', array('tournament' => $tour));
}
示例12: __invoke
/**
* Call this class as a function.
*
* @return void
*/
public function __invoke()
{
$request = MessageBridge::newOAuth2Request($this->slim->request());
$response = new OAuth2\Response();
$isValid = $this->server->validateAuthorizeRequest($request, $response);
if (!$isValid) {
MessageBridge::mapResponse($response, $this->slim->response());
return;
}
$authorized = $this->slim->request()->params('authorized');
if (empty($authorized)) {
$this->slim->render($this->template, ['client_id' => $request->query('client_id', false)]);
return;
}
//@TODO implement user_id
$this->server->handleAuthorizeRequest($request, $response, $authorized === 'yes');
MessageBridge::mapResponse($response, $this->slim->response());
}
示例13: action_exportDialog
public function action_exportDialog(Slim $app, $setupId, $fitId)
{
if (!$app->user->isLoggedin()) {
return false;
}
$setup = $app->evefit->getSetup($setupId);
$fit = $setup->getFit($fitId);
$app->render('fit/exportDialog.twig', array('setupId' => $setupId, 'fit' => $fit));
}
示例14: dequeueItem
/**
* GET /feed/item/queue
*/
public function dequeueItem()
{
$itemQueue = new ItemQueue();
if ($itemQueue->dequeue()) {
$this->getItem($itemQueue->id_item);
} else {
$this->app->render(404);
}
}
示例15: action_fitList
/**
* Returns partialHTML of a list of fits.
*
* @param \Slim\Slim $app
*/
public function action_fitList(Slim $app, $setupId, $fitId)
{
if (!$app->user->isLoggedin()) {
return false;
}
$setup = $app->evefit->getSetup($setupId);
$fit = $setup->getFit($fitId);
$tour = $app->rulechecker->getTournament();
$app->render('fit/fit.twig', array('setup' => $setup, 'fit' => $fit, 'tournament' => $tour));
}