本文整理汇总了PHP中Twig_Environment::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Environment::display方法的具体用法?PHP Twig_Environment::display怎么用?PHP Twig_Environment::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* @see IRenderEngine::display()
*/
function display($template)
{
if (strpos('.', $template) === false) {
$template .= '.html';
}
return $this->twig->display($template, $this->assignments);
}
示例2: display
/**
* Display a template for provided handle.
*
* The template will be loaded and compiled, if necessary, first.
*
* This function calls hooks.
*
* @param string $handle Handle to display
* @return \phpbb\template\template $this
*/
public function display($handle)
{
$result = $this->call_hook($handle, __FUNCTION__);
if ($result !== false) {
return $result[0];
}
$this->twig->display($this->get_filename_from_handle($handle), $this->get_template_vars());
return $this;
}
示例3: display
public function display($template, $data = [], $config = [])
{
if ($config) {
$this->config($config);
}
$key = md5($template);
$loader = new \Twig_Loader_Array([$key => $template]);
$twig = new \Twig_Environment($loader, ['debug' => APP_DEBUG, 'auto_reload' => true, 'cache' => $this->config['cache_path']]);
$twig->display($key, $data);
}
示例4: renderPaymentScripts
/**
* Render banwire scripts view
*/
public function renderPaymentScripts()
{
$this->environment->display('BanwireBundle:Banwire:scripts.html.twig', array('currency' => $this->paymentBridgeInterface->getCurrency()));
}
示例5: display
/**
* {@inheritdoc}
*/
public function display($name, array $context = [])
{
$level = ob_get_level();
ob_start();
try {
parent::display($name, $context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
$output = ob_get_clean();
echo $this->inject_assets($output);
}
示例6: array
<?php
declare (encoding='UTF-8');
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader);
require_once "SizePrice.php";
require_once "Item.php";
require_once "config.php";
$twig->display('index.html', array("items" => $items));
示例7: renderPaymentView
/**
* Render redsys api form view
*
* @param string $viewTemplate An optional template to render.
*
* @return string view html
*/
public function renderPaymentView($viewTemplate = null)
{
$formType = $this->formFactory->create('redsys_api_type');
$this->environment->display($viewTemplate ?: $this->viewTemplate, array('redsys_api_form' => $formType->createView(), 'redsys_api_execute_route' => RedsysApiRoutesLoader::ROUTE_NAME));
}
示例8: display
/**
* display the template
* @param string $template template name
* @param bool $defaultExtension if to use the default template engine's file extension for template files
* @return ITemplateEngine
*/
public function display($template, $defaultExtension = false)
{
$this->twigEnv->display($template . ($defaultExtension ? self::DEFAULT_EXTENSION : ''), $this->variables);
return $this;
}
示例9: function
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once __DIR__ . '/vendor/autoload.php';
$loader = new Twig_Loader_Filesystem(__DIR__ . '/templates');
$twig = new Twig_Environment($loader);
$twig->addFunction(new \Twig_SimpleFunction('asset', function ($asset) {
return '/build/' . ltrim($asset, '/');
}));
$uriParts = explode('?', $_SERVER['REQUEST_URI']);
$templatePath = $uriParts[0] . (substr($uriParts[0], -1, 1) === '/' ? 'index' : '');
try {
$twig->display("pages{$templatePath}.html.twig");
} catch (Twig_Error_Loader $e) {
header('HTTP/1.0 404 Not Found');
$twig->display('errors/404.html.twig');
} catch (RuntimeException $e) {
$twig->display('errors/runtime.html.twig', array('error' => $e));
}
示例10: renderPaymentScripts
/**
* Render stripe scripts view
*
* @return string js code needed by Stripe behaviour
*/
public function renderPaymentScripts()
{
return $this->environment->display($this->scriptsTemplate, array('public_key' => $this->publicKey, 'currency' => $this->paymentBridgeInterface->getCurrency()));
}
示例11: render
/**
* Extended view, for detailed representation
*/
public function render(\Twig_Environment $env, array $params)
{
$params = array_merge(array('date' => $this), $params);
$env->display("@values/date.twig", $params);
}
示例12: display
public function display($name, array $context = array())
{
return parent::display($name, $this->transformContext($context));
}
示例13: explode
$action = explode('/', substr($query, 1));
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
//JSON
if ($_SERVER['REQUEST_URI'] = '/getEvents') {
$events = $_POST['events'];
if (count($events) > 0) {
$events = implode(',', $events);
echo json_encode(Fetch($config['query']['getEventsByIDs'], ['ids' => $events]));
}
}
} else {
if ($action[0] == 'card') {
//=============================card=============================
if (isset($action[1])) {
$res = Fetch($config['query']['getEventsByNumber'], ['number' => $action[1]]);
$twig->display('log_detail.twig', array('cards' => $res, 'env' => $env));
} else {
$res = Fetch($config['query']['getSplash'][$env['db']['alias']], ['limit' => 500]);
$twig->display('card.twig', array('cards' => $res, 'env' => $env));
}
} elseif ($action[0] == 'test') {
//=============================test=============================
echo "<pre>" . print_r($config, true) . "</pre>>";
} elseif ($action[0] == 'db') {
//=============================db=============================
if (isset($config['dbs'][$action[1]])) {
$_SESSION['db'] = $config['dbs'][$action[1]];
$url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';
header('Location: ' . $url);
} else {
header("HTTP/1.0 500 Internal Server Error ");
示例14: render
/**
* Extended view, for detailed representation
*/
public function render(\Twig_Environment $env, array $params)
{
$params = array_merge(array('text' => $this, 'plain' => false), $params);
$env->display("@values/text.twig", $params);
}
示例15: array
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
require_once '../vendor/autoload.php';
// Twig инициализация
$loader = new Twig_Loader_Filesystem('../templates');
// Twig папка с шаблонами
//$twig = new Twig_Environment($loader, array('cache' => 'cache',));
$twig = new Twig_Environment($loader, array('cache' => '', 'trim_blocks' => true));
echo $twig->display(basename(__DIR__) . '.twig', array('admin_fio' => 'Калиничев Владимир', 'section' => basename(__DIR__), 'sections' => array('' => 'Home', 'bills' => 'Счета', 'users' => 'Пользователи', 'supply' => 'Расходники')));