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


PHP Page::render方法代码示例

本文整理汇总了PHP中Page::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::render方法的具体用法?PHP Page::render怎么用?PHP Page::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Page的用法示例。


在下文中一共展示了Page::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 /**
  * Build page from database
  * @param array $data
  */
 public static function build(array $data)
 {
     if (!isset($data['title'], $data['body'])) {
         return;
     }
     $content = new Page($data['title'], $data['body']);
     if (isset($data['stylesheets'])) {
         foreach ($data['stylesheets'] as $source) {
             $content->addStylesheet($source);
         }
     }
     if (isset($data['javascripts'])) {
         foreach ($data['javascripts'] as $source) {
             $content->addJavascript($source);
         }
     }
     $content->render('system.header');
     if (isset($data['header'])) {
         $content->setHeader($data['header']);
     }
     $content->render('system.footer');
     if (isset($data['footer'])) {
         $content->setFooter($data['footer']);
     }
     return $content->publish();
 }
开发者ID:ZephyrusDev,项目名称:-Hybrid,代码行数:30,代码来源:View.php

示例2: deploy

 function deploy($xml)
 {
     $Page = new Page();
     $blcks = $xml->blocks->block;
     $locals = (array) $xml->vars;
     $locals['catalogue'] = $Page->catalogue();
     $locals['blocks'] = $Page->render_blocks($blcks, $locals);
     $locals['modals'] = $Page->render('modals', $locals);
     $content = $Page->render('layout', $locals);
     file_put_contents(ROOTPATH . '/app/data/result.html', $content);
 }
开发者ID:ablebeam,项目名称:some-code-samples,代码行数:11,代码来源:base.php

示例3: render

 function render()
 {
     $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/elfinder.min.css" rel="stylesheet" />' . "\n");
     $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/theme.css" rel="stylesheet" />' . "\n");
     $this->api->template->appendHTML('js_include', '<script src="elfinder/js/elfinder.min.js"></script>' . "\n");
     parent::render();
 }
开发者ID:xepan,项目名称:xepan,代码行数:7,代码来源:owner.php

示例4: render_cache

 /**
  * Most important function: Render page and cache the output
  *
  * @param  Page   $page     $page we are rendering
  * @param  string $filename template file name we use
  * @param  array  $options  options we pass through to $page->render()
  * @return string           output
  */
 private function render_cache(Page $page, $filename, $options)
 {
     $cache = $this->modules->get('MarkupCache');
     $lang = $this->user->language ? $this->user->language->name : '';
     $id = str_replace('/', '.', implode('.', array_filter([$page->id, $lang, $filename])));
     if ($this->config->bypassPageRenderCache) {
         $data = $page->render("{$filename}.php", $options);
     } else {
         $data = $cache->get($id);
         if (!$data) {
             $data = $page->render("{$filename}.php", $options);
             $cache->save($data);
         }
     }
     return $data;
 }
开发者ID:adamkiss,项目名称:PageRenderCache,代码行数:24,代码来源:PageRenderCache.module.php

示例5: index

 function index($urlParts)
 {
     $page = new Page();
     $content = Content::getAll('post');
     $page->addRenderable('content', $content);
     $page->render();
 }
开发者ID:natewilliford,项目名称:cmsexp,代码行数:7,代码来源:Index.php

示例6: render

 /**
  * @throws \Error
  */
 public function render()
 {
     $h = $this->_config['header_func'] ?? 'header';
     if (is_callable($h) == false) {
         throw new \Error("Header function injected to Error is not callable");
     }
     $errorPage = null;
     switch ($this->code) {
         case 404:
             $h("HTTP/1.0 404 Not Found");
             $errorPage = new Page(new Request(['url' => '404']), $this->_config);
             break;
         case 400:
             $h("HTTP/1.0 400 {$this->message}");
             break;
         default:
             $h("HTTP/1.0 {$this->code} Bad request");
             $errorPage = new Page(new Request(['url' => '500']), $this->_config);
             break;
     }
     if ($errorPage) {
         // TODO only do this if request accepts html?
         try {
             $errorPage->setData('message', $this->message);
             echo $errorPage->render();
         } catch (\alkemann\h2l\exceptions\InvalidUrl $e) {
             if (defined('DEBUG') && DEBUG) {
                 echo "No error page made at " . $e->getMessage();
             }
         }
     }
 }
开发者ID:alkemann,项目名称:h2l,代码行数:35,代码来源:Error.php

示例7: render

 function render()
 {
     $this->api->template->del("Menu");
     $this->api->template->del("logo");
     $this->api->template->trySet("Content", "");
     $this->api->template->trySet("Footer", "");
     parent::render();
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:8,代码来源:studentlistR.php

示例8: render

 function render()
 {
     // $this->api->template->del('header');
     // $this->api->template->del('logo');
     $this->api->template->del('Menu');
     // $this->api->template->del('date');
     $this->api->template->del('welcome');
     // $this->api->template->del('footer_text');
     parent::render();
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:10,代码来源:resultonline.php

示例9: testRenderingSimple

 public function testRenderingSimple()
 {
     try {
         $config = $this->_setupFolder();
         $this->_setupViewFiles($config);
     } catch (\Throwable $t) {
         //
         $this->markTestSkipped("Skipping File test: " . $t->getMessage());
     }
     // $request = new Request(); // @TODO use a mock instead
     $request = $this->getMock('alkemann\\h2l\\Request', ['type', 'route', 'method'], [], 'Request', false);
     $request->expects($this->once())->method('type')->willReturn('html');
     $request->expects($this->once())->method('route')->willReturn(new Route('place'));
     $config['content_path'] = substr($config['content_path'], 0, -6);
     $page = new Page($request, $config);
     $expected = '<html><body><div><h1>Win!</h1></div></body></html>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $page->layout = 'spicy';
     $expected = '<html><title>Spice</title><body><h1>Win!</h1></body></html>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $page->layout = 'doesntexist';
     $expected = '<h1>Win!</h1>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $this->_cleanupViewFiles();
     $caught = false;
     // invalid url;
     try {
         $result = $page->render();
     } catch (\alkemann\h2l\exceptions\InvalidUrl $e) {
         $caught = true;
     }
     $this->assertTrue($caught, 'Exception was not thrown for missing page');
 }
开发者ID:alkemann,项目名称:h2l,代码行数:36,代码来源:PageTest.php

示例10: render

 function render($region = "")
 {
     if ($region == "project") {
         $page = find($this, "Page", "path", $this->path);
         if ($page == null) {
             if (strpos($this->path, "/") !== false) {
                 $parts = explode("/", $this->path);
                 $page = find($this, "Page", "path", $parts[0]);
                 if ($page == null) {
                     $page = new Page($this, '{ "name":"404", "file":"threephp/inc/404.php" }');
                 }
             }
         }
         echo $page->render("page");
     }
 }
开发者ID:jeroendhvv,项目名称:three.php,代码行数:16,代码来源:project.php

示例11: render

 function render()
 {
     $this->api->template->appendHTML('js_include', '<script src="templates/js/jquery.sharrre.js"></script>' . "\n");
     if ($this->api->getConfig('css_mode') == 'less') {
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/css/epan.less" rel="stylesheet/less" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/default/js/less.min.js"></script>' . "\n");
     } else {
         // Moved to FrontEnd
         // $this->api->template->appendHTML('js_include','<link type="text/css" href="templates/default/css/epan.css" rel="stylesheet" />'."\n");
     }
     if ($this->api->edit_mode) {
         /**
          * Main Live Editor JavaScript File handling All Editor based working
          */
         $this->js()->_load('epan_live_edit');
         // Add Div to stop being accessed before fully loaded
         // $this->api->template->appendHTML('Content','<div id="overlay-dark"><H3 id="overlay-dark-message">Wait, Loading ...</h3> </div>');
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/css/epan_live.css" rel="stylesheet" />' . "\n");
         // $this->api->template->appendHTML('js_include','<link type="text/css" href="templates/js/jquery.jscrollpane.css" rel="stylesheet" />'."\n");
         // $this->api->template->appendHTML('js_include','<script src="templates/js/jquery.jscrollpane.min.js"></script>'."\n");
         // SHORTCUTS
         $this->api->template->appendHTML('js_include', '<script src="templates/js/shortcut.js"></script>' . "\n");
         // POPLINE EDITING
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/css/normalize.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/themes/default.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/js/popline/build/jquery.popline.min.js"></script>' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/font-awesome/css/font-awesome.min.css" rel="stylesheet" />' . "\n");
         // Font Awsome
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/font-awesome/css/font-awesome.min.css" rel="stylesheet" />' . "\n");
         // Google font selector
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/fontselect.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/js/jquery.fontselect.js"></script>' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/elfinder.min.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/theme.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="elfinder/js/elfinder.min.js"></script>' . "\n");
     }
     $theme_css = 'epans/' . $this->api->current_website['name'] . '/theme.css';
     if (file_exists(getcwd() . DS . $theme_css)) {
         $this->api->template->appendHTML('js_include', '<link id="xepan-theme-css-link" type="text/css" href="' . $theme_css . '" rel="stylesheet" />' . "\n");
     }
     $user_css = 'epans/' . $this->api->current_website['name'] . '/mystyles.css';
     if (file_exists(getcwd() . DS . $user_css)) {
         $this->api->template->appendHTML('js_include', '<link id="xepan-mystyles-css-link" type="text/css" href="' . $user_css . '" rel="stylesheet" />' . "\n");
     }
     parent::render();
 }
开发者ID:xepan,项目名称:xepan,代码行数:46,代码来源:index.php

示例12: run

 public static function run($uri = '')
 {
     self::$dispatcher = new Dispatcher($uri);
     $controller_class = ucfirst(self::$dispatcher->getController()) . 'Controller';
     $controller_method = strtolower(self::$dispatcher->getAction()) . 'Action';
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $controller_object->{$controller_method}();
         $layout = $controller_object->getLayout();
         if ($layout != '') {
             $page = new Page($layout, $controller_object->getData());
         } else {
             $page = new Page('default');
         }
         $page->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of ' . $controller_class . ' class in not found!');
     }
 }
开发者ID:JoniRambro,项目名称:wave,代码行数:19,代码来源:app.php

示例13: add

<?php

require 'Renderers.php';
class Page
{
    protected $renderers = [];
    public function add(Renderer $renderer)
    {
        $this->renderers[] = $renderer;
    }
    public function render()
    {
        $content = '';
        $content .= "--Start of Page--\n";
        $content .= array_reduce($this->renderers, function ($output, $r) {
            return $output .= $r->render() . "\n";
        }, '');
        $content .= "--End of Page--\n";
        return $content;
    }
}
$page = new Page();
$page->add(new BlogRenderer());
$page->add(new ArticleRenderer());
$page->add(new GraphRenderer());
// $page->add(new Page());
echo $page->render();
开发者ID:elagith,项目名称:learningMaterial,代码行数:27,代码来源:Example.php

示例14:

 */
if (file_exists('bootstrap.php')) {
    require 'bootstrap.php';
}
/**
 * Initialize the built-in cache support. Provides a
 * consistent cache API (based on Memcache) so we can always
 * include caching in our handlers and in the front controller.
 */
if (!isset($memcache) || !is_object($memcache)) {
    $memcache = Cache::init(conf('Cache'));
}
/**
 * Route the request to the appropriate handler and get
 * the handler's response.
 */
if ($i18n->url_includes_lang) {
    $handler = $controller->route($i18n->new_request_uri);
} else {
    $handler = $controller->route($_SERVER['REQUEST_URI']);
}
$page->body = $controller->handle($handler, false);
/**
 * Render and send the output to the client, using gzip
 * compression if conf[General][compress_output] is true.
 */
$out = $page->render($tpl);
if (conf('General', 'compress_output') && extension_loaded('zlib')) {
    ob_start('ob_gzhandler');
}
echo $out;
开发者ID:nathanieltite,项目名称:elefant,代码行数:31,代码来源:index.php

示例15: echoPage

function echoPage(Page $obj)
{
    $obj->render();
}
开发者ID:igorsimdyanov,项目名称:php7,代码行数:4,代码来源:cast.php


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