本文整理汇总了PHP中HTMLPage::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPage::generate方法的具体用法?PHP HTMLPage::generate怎么用?PHP HTMLPage::generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPage
的用法示例。
在下文中一共展示了HTMLPage::generate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Called by index.php, this function is responsible for rendering the current
* page on the Frontend. Two delegates are fired, AdminPagePreGenerate and
* AdminPagePostGenerate. This function runs the Profiler for the page build
* process.
*
* @uses AdminPagePreGenerate
* @uses AdminPagePostGenerate
* @see core.Symphony#__buildPage()
* @see boot.getCurrentPage()
* @param string $page
* The result of getCurrentPage, which returns the $_GET['symphony-page']
* variable.
* @throws Exception
* @throws SymphonyErrorPage
* @return string
* The HTML of the page to return
*/
public function display($page)
{
Symphony::Profiler()->sample('Page build process started');
$this->__buildPage($page);
// Add XSRF token to form's in the backend
if (self::isXSRFEnabled() && isset($this->Page->Form)) {
$this->Page->Form->prependChild(XSRF::formToken());
}
/**
* Immediately before generating the admin page. Provided with the page object
* @delegate AdminPagePreGenerate
* @param string $context
* '/backend/'
* @param HTMLPage $oPage
* An instance of the current page to be rendered, this will usually be a class that
* extends HTMLPage. The Symphony backend uses a convention of contentPageName
* as the class that extends the HTMLPage
*/
Symphony::ExtensionManager()->notifyMembers('AdminPagePreGenerate', '/backend/', array('oPage' => &$this->Page));
$output = $this->Page->generate();
/**
* Immediately after generating the admin page. Provided with string containing page source
* @delegate AdminPagePostGenerate
* @param string $context
* '/backend/'
* @param string $output
* The resulting backend page HTML as a string, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('AdminPagePostGenerate', '/backend/', array('output' => &$output));
Symphony::Profiler()->sample('Page built');
return $output;
}
示例2: generate
public function generate($page = null)
{
$this->Html->setDTD('<!DOCTYPE html>');
$this->Html->setAttribute('lang', Lang::get());
$this->addHeaderToPage('Cache-Control', 'no-cache, must-revalidate, max-age=0');
$this->addHeaderToPage('Expires', 'Mon, 12 Dec 1982 06:14:00 GMT');
$this->addHeaderToPage('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
$this->addHeaderToPage('Pragma', 'no-cache');
$this->setTitle($this->_page_title);
$this->addElementToHead(new XMLElement('meta', null, array('charset' => 'UTF-8')), 1);
$this->addStylesheetToHead(APPLICATION_URL . '/assets/css/installer.min.css', 'screen', 30);
return parent::generate($page);
}
示例3: generate
public function generate()
{
$this->Html->setDTD('<!DOCTYPE html>');
$this->Html->setAttribute('lang', Lang::get());
$this->setTitle($this->_page_title);
$this->addElementToHead(new XMLElement('meta', NULL, array('charset' => 'UTF-8')), 1);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.css', 'screen', 30);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.grids.css', 'screen', 31);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.forms.css', 'screen', 32);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.frames.css', 'screen', 33);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/css/installer.css', 'screen', 40);
return parent::generate();
}
示例4: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addElementToHead(new XMLElement('link', NULL, array('rel' => 'icon', 'href' => URL . '/symphony/assets/images/bookmark.png', 'type' => 'image/png')), 20);
$Page->addStylesheetToHead(URL . '/symphony/assets/error.css', 'screen', 30);
$Page->addElementToHead(new XMLElement('!--[if IE]><link rel="stylesheet" href="' . URL . '/symphony/assets/legacy.css" type="text/css"><![endif]--'), 40);
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'generic');
if (isset($additional['header'])) {
$Page->addHeaderToPage($additional['header']);
}
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), $heading)));
$div = new XMLElement('div', NULL, array('id' => 'description'));
$div->appendChild(new XMLElement('h1', $heading));
$div->appendChild(is_object($errstr) ? $errstr : new XMLElement('p', trim($errstr)));
$Page->Body->appendChild($div);
print $Page->generate();
exit;
示例5: generate
function generate($page, $xml, $xsl, $output, $parameters)
{
$this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$this->Html->setElementStyle('html');
$this->Html->setDTD('<!DOCTYPE html>');
//PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
$this->Html->setAttribute('lang', __LANG__);
$this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$this->addElementToHead(new XMLElement('link', NULL, array('rel' => 'icon', 'href' => URL . '/symphony/assets/images/bookmark.png', 'type' => 'image/png')), 20);
$this->addStylesheetToHead(URL . '/symphony/assets/debug.css', 'screen', 40);
$this->addElementToHead(new XMLElement('!--[if IE]><link rel="stylesheet" href="' . URL . '/symphony/assets/legacy.css" type="text/css"><![endif]--'), 50);
$this->addScriptToHead(URL . '/symphony/assets/admin.js', 60);
$this->setTitle(__('%1$s – %2$s – %3$s', array(__('Symphony'), __('Debug'), $page['title'])));
$h1 = new XMLElement('h1');
$h1->appendChild(Widget::Anchor($page['title'], $this->_query_string ? '?' . trim($this->_query_string, '&') : '.'));
$this->Body->appendChild($h1);
$this->Body->appendChild($this->__buildNavigation($page));
$utilities = $this->__findUtilitiesInXSL($xsl);
$this->Body->appendChild($this->__buildJump($page, $xsl, $_GET['debug'], $utilities));
if ($_GET['debug'] == 'params') {
$this->Body->appendChild($this->__buildParams($parameters));
} elseif ($_GET['debug'] == 'xml' || strlen(trim($_GET['debug'])) <= 0) {
$this->Body->appendChildArray($this->__buildCodeBlock($xml, 'xml'));
} elseif ($_GET['debug'] == 'result') {
$this->Body->appendChildArray($this->__buildCodeBlock($output, 'result'));
} else {
if ($_GET['debug'] == basename($page['filelocation'])) {
$this->Body->appendChildArray($this->__buildCodeBlock($xsl, basename($page['filelocation'])));
} elseif ($_GET['debug'][0] == 'u') {
if (is_array($this->_full_utility_list) && !empty($this->_full_utility_list)) {
foreach ($this->_full_utility_list as $u) {
if ($_GET['debug'] != 'u-' . basename($u)) {
continue;
}
$this->Body->appendChildArray($this->__buildCodeBlock(@file_get_contents(UTILITIES . '/' . basename($u)), 'u-' . basename($u)));
break;
}
}
}
}
return parent::generate();
}
示例6: generate
/**
* Appends the `$this->Header`, `$this->Contents` and `$this->Footer`
* to `$this->Wrapper` before adding the ID and class attributes for
* the `<body>` element. After this has completed the parent's generate
* function is called which will convert the `XMLElement`'s into strings
* ready for output
*
* @return string
*/
public function generate()
{
$this->Wrapper->appendChild($this->Header);
$this->Wrapper->appendChild($this->Contents);
$this->Wrapper->appendChild($this->Footer);
$this->Body->appendChild($this->Wrapper);
$this->__appendBodyId();
$this->__appendBodyClass($this->_context);
return parent::generate();
}
示例7: build
/**
* Called when page is generated, this function calls each of the other
* other functions in this page to build the Header, the Navigation,
* the Jump menu and finally the content. This function calls it's parent
* generate function
*
* @see toolkit.HTMLPage#generate()
* @return string
*/
public function build()
{
$this->buildIncludes();
$header = new XMLElement('div');
$header->setAttribute('id', 'header');
$jump = new XMLElement('div');
$jump->setAttribute('id', 'jump');
$content = new XMLElement('div');
$content->setAttribute('id', 'content');
$this->buildHeader($header);
$this->buildNavigation($header);
$this->buildJump($jump);
$header->appendChild($jump);
$this->Body->appendChild($header);
$this->buildContent($content);
$this->Body->appendChild($content);
return parent::generate();
}
示例8: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addStylesheetToHead(URL . '/symphony/assets/error.css', 'screen', 30);
$Page->addHeaderToPage('HTTP/1.0 500 Server Error');
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'generic');
if (isset($e->getAdditional()->header)) {
$Page->addHeaderToPage($e->getAdditional()->header);
}
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), $e->getHeading())));
$div = new XMLElement('div', NULL, array('id' => 'description'));
$div->appendChild(new XMLElement('h1', $e->getHeading()));
$div->appendChild($e->getMessageObject() instanceof XMLElement ? $e->getMessageObject() : new XMLElement('p', trim($e->getMessage())));
$Page->Body->appendChild($div);
$output = $Page->generate();
header(sprintf('Content-Length: %d', strlen($output)));
echo $output;
exit;
示例9: generate
/**
* Appends the `$this->Header`, `$this->Context` and `$this->Contents`
* to `$this->Wrapper` before adding the ID and class attributes for
* the `<body>` element. This function will also place any Drawer elements
* in their relevant positions in the page. After this has completed the
* parent `generate()` is called which will convert the `XMLElement`'s
* into strings ready for output.
*
* @see core.HTMLPage#generate()
* @return string
*/
public function generate()
{
$this->Wrapper->appendChild($this->Header);
// Add horizontal drawers (inside #context)
if (isset($this->Drawer['horizontal'])) {
$this->Context->appendChildArray($this->Drawer['horizontal']);
}
$this->Wrapper->appendChild($this->Context);
// Add vertical-left drawers (between #context and #contents)
if (isset($this->Drawer['vertical-left'])) {
$this->Wrapper->appendChildArray($this->Drawer['vertical-left']);
}
// Add vertical-right drawers (after #contents)
if (isset($this->Drawer['vertical-right'])) {
$this->Wrapper->appendChildArray($this->Drawer['vertical-right']);
}
$this->Wrapper->appendChild($this->Contents);
$this->Body->appendChild($this->Wrapper);
$this->__appendBodyId();
$this->__appendBodyClass($this->_context);
return parent::generate();
}
示例10: generate
public function generate()
{
$this->appendContent();
return parent::generate();
}
示例11: generate
function generate($page, $profiler, $database)
{
$this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$this->Html->setElementStyle('html');
$this->Html->setDTD('<!DOCTYPE html>');
//PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
$this->Html->setAttribute('lang', __LANG__);
$this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$this->addElementToHead(new XMLElement('link', NULL, array('rel' => 'icon', 'href' => URL . '/symphony/assets/images/bookmark.png', 'type' => 'image/png')), 20);
$this->addStylesheetToHead(URL . '/symphony/assets/debug.css', 'screen', 40);
$this->addElementToHead(new XMLElement('!--[if IE]><link rel="stylesheet" href="' . URL . '/symphony/assets/legacy.css" type="text/css"><![endif]--'), 50);
$this->addScriptToHead(URL . '/symphony/assets/admin.js', 60);
$this->setTitle(__('%1$s – %2$s – %3$s', array(__('Symphony'), __('Page Profiler'), $page['title'])));
$h1 = new XMLElement('h1');
$h1->appendChild(Widget::Anchor($page['title'], $this->_query_string ? '?' . trim($this->_query_string, '&') : '.'));
$this->Body->appendChild($h1);
$this->Body->appendChild($this->__buildNavigation($page));
$jump = new XMLElement('ul', NULL, array('id' => 'jump'));
$records = array();
$dbstats = $database->getStatistics();
$profile_group = strlen(trim($_GET['profile'])) == 0 ? 'general' : $_GET['profile'];
$records['general'] = $profiler->retrieveGroup('General');
if (is_array($records['general']) && !empty($records['general'])) {
$jump->appendChild(self::__appendNavigationItem('General Details', '?profile=general' . $this->_query_string, $profile_group == 'general'));
}
$records['data-sources'] = $profiler->retrieveGroup('Datasource');
if (is_array($records['data-sources']) && !empty($records['data-sources'])) {
$jump->appendChild(self::__appendNavigationItem('Data Source Execution', '?profile=data-sources' . $this->_query_string, $profile_group == 'data-sources'));
}
$records['events'] = $profiler->retrieveGroup('Event');
if (is_array($records['events']) && !empty($records['events'])) {
$jump->appendChild(self::__appendNavigationItem('Event Execution', '?profile=events' . $this->_query_string, $profile_group == 'events'));
}
$jump->appendChild(self::__appendNavigationItem('Full Page Render Statistics', '?profile=render-statistics' . $this->_query_string, $profile_group == 'render-statistics'));
if (is_array($dbstats['slow-queries']) && !empty($dbstats['slow-queries'])) {
$records['slow-queries'] = array();
foreach ($dbstats['slow-queries'] as $q) {
$records['slow-queries'][] = array($q['time'], $q['query'], NULL, NULL, false);
}
$jump->appendChild(self::__appendNavigationItem('Slow Query Details', '?profile=slow-queries' . $this->_query_string, $profile_group == 'slow-queries'));
}
switch ($profile_group) {
case 'general':
$dl = new XMLElement('dl', NULL, array('id' => 'general'));
foreach ($records['general'] as $r) {
$dl->appendChild(new XMLElement('dt', $r[0]));
$dl->appendChild(new XMLElement('dd', $r[1] . ' s'));
}
$this->Body->appendChild($dl);
break;
###
###
case 'data-sources':
$ds_total = 0;
$dl = new XMLElement('dl', NULL, array('id' => 'data-sources'));
foreach ($records['data-sources'] as $r) {
$dl->appendChild(new XMLElement('dt', $r[0]));
$dl->appendChild(new XMLElement('dd', $r[1] . ' s'));
$ds_total += $r[1];
}
$this->Body->appendChild($dl);
break;
###
###
case 'events':
$event_total = 0;
$dl = new XMLElement('dl', NULL, array('id' => 'events'));
foreach ($records['events'] as $r) {
$dl->appendChild(new XMLElement('dt', $r[0]));
$dl->appendChild(new XMLElement('dd', $r[1] . ' s'));
$event_total += $r[1];
}
$this->Body->appendChild($dl);
break;
###
###
case 'render-statistics':
$xml_generation = $profiler->retrieveByMessage('XML Generation');
$xsl_transformation = $profiler->retrieveByMessage('XSLT Transformation');
$records = array(array(__('Total Database Queries'), $dbstats['queries'], NULL, NULL, false), array(__('Slow Queries (> 0.09s)'), count($dbstats['slow-queries']), NULL, NULL, false), array(__('Total Time Spent on Queries'), $dbstats['total-query-time']), array(__('Time Triggering All Events'), $event_total), array(__('Time Running All Data Sources'), $ds_total), array(__('XML Generation Function'), $xml_generation[1]), array(__('XSLT Generation'), $xsl_transformation[1]), array(__('Output Creation Time'), $profiler->retrieveTotalRunningTime()));
$dl = new XMLElement('dl', NULL, array('id' => 'render-statistics'));
foreach ($records as $r) {
$dl->appendChild(new XMLElement('dt', $r[0]));
$dl->appendChild(new XMLElement('dd', $r[1] . (isset($r[4]) && $r[4] == false ? '' : ' s')));
}
$this->Body->appendChild($dl);
break;
###
###
case 'slow-queries':
$dl = new XMLElement('dl', NULL, array('id' => 'slow-queries'));
foreach ($records['slow-queries'] as $r) {
$dl->appendChild(new XMLElement('dt', $r[0]));
$dl->appendChild(new XMLElement('dd', $r[1] . (isset($r[4]) && $r[4] == false ? '' : ' s')));
}
$this->Body->appendChild($dl);
break;
###
}
$this->Body->appendChild($jump);
//.........这里部分代码省略.........