当前位置: 首页>>代码示例>>PHP>>正文


PHP h2o::loadTemplate方法代码示例

本文整理汇总了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/');
 }
开发者ID:tonjoo,项目名称:tiga-framework,代码行数:7,代码来源:inheritance_spec.php

示例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'));
 }
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:15,代码来源:Notification.php

示例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;
}
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:37,代码来源:routes.php

示例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);
开发者ID:nielsvm,项目名称:lxc-containers,代码行数:30,代码来源:index.php


注:本文中的h2o::loadTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。