本文整理汇总了PHP中h2o::loadTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP h2o::loadTemplate方法的具体用法?PHP h2o::loadTemplate怎么用?PHP h2o::loadTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类h2o
的用法示例。
在下文中一共展示了h2o::loadTemplate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: should_display_correct_block_depth_level
public function should_display_correct_block_depth_level()
{
$h2o = new h2o('blog', $this->option);
expects($h2o->render())->should_be('depth: 1');
$h2o->loadTemplate('home');
expects($h2o->render())->should_match('/depth: 2/');
}
示例2: renderEmail
/**
* Render template with variables for sending in an email
*
* @param $template
* @param $page
* @return string
*/
static function renderEmail($template, $page)
{
// H2o object for rendering
$h2o = new h2o(null, array('autoescape' => false));
// Load template and render it
$h2o->loadTemplate(__DIR__ . '/../views/' . $template);
return $h2o->render(compact('page'));
}
示例3: superHandler
/**
* Handles rendering the header, footer, content and initialising the page
*
* @param $parameters
* @return string
*/
function superHandler($parameters)
{
// Set our controller and view directories
$controllerDirectory = __DIR__ . '/../controllers/';
$viewDirectory = __DIR__ . '/../views/';
// Initialise our page array
$page = Session::init($parameters['title'], $parameters['flashes'], $parameters['restricted']);
// if parameters are passed, then add them
if (array_key_exists('parameters', $parameters)) {
$page['parameters'] = $parameters['parameters'];
}
// Require our controller
require $controllerDirectory . $parameters['controller'];
// Initialise our h2o object
$h2o = new h2o(null, array('autoescape' => false));
$output = "";
if (array_key_exists('header', $parameters) && $parameters['header'] == true) {
$h2o->loadTemplate($viewDirectory . 'global/header.html');
$output .= $h2o->render(compact('page'));
}
if ($parameters['view'] != null) {
$h2o->loadTemplate($viewDirectory . $parameters['view']);
$output .= $h2o->render(compact('page'));
}
if (array_key_exists('footer', $parameters) && $parameters['footer'] == true) {
$h2o->loadTemplate($viewDirectory . 'global/footer.html');
$output .= $h2o->render(compact('page'));
}
// return output
return $output;
}
示例4: function
require 'vendor/autoload.php';
/**
* Let the provisioner automatically intervene and reconfigure Apache. This only
* happens when users try to access a domain that Apache isn't aware off yet and
* the provisioner will then - just in time - install vhost files and reload.
*/
\LXC\VirtualHost\ApacheProvisioner::check('root', 'root', 'templates/rebuilding.html', 'templates/vhost.conf');
/**
* Configure the router.
*/
$router = new \Bramus\Router\Router();
$t = new \h2o();
# ROUTE /: index listing.
$router->get('/', function () use($t) {
$t->loadTemplate('templates/listing.html');
print $t->render(array('lxc' => \LXC\Container\Variables::get(), 'vhosts' => \LXC\VirtualHost\Listing::get(), 'hostsoutdated' => \LXC\VirtualHost\Listing::are_hosts_outdated(), 'logfiles' => \LXC\Logging\Files::get(), 'hostname' => gethostname()));
});
# ROUTE /php: PHP information.
$router->get('/php', function () {
phpinfo();
});
# ROUTE /$LOGFILE: tail -f style log viewer.
foreach (\LXC\Logging\Files::get() as $logfile) {
$path = '/' . $logfile->name;
$router->get($path, function () use($t, $logfile) {
$t->loadTemplate('templates/logtail.html');
print $t->render(array('file' => $logfile, 'lxc' => \LXC\Container\Variables::get(), 'hostname' => gethostname()));
});
$router->get($path . '/(\\d+)', function ($from_line) use($t, $logfile) {
$logfile->sendPayload((int) $from_line);