本文整理汇总了PHP中Layout类的典型用法代码示例。如果您正苦于以下问题:PHP Layout类的具体用法?PHP Layout怎么用?PHP Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderRoute
public function renderRoute($vars)
{
$config = Config::getInstance();
$queries = CMS7_Queries::getInstance();
$config->queries = $queries;
$config->theme_path = join_path($config->base_path, 'themes');
$config->module_path = join_path($config->base_path, 'modules');
$config->plugin_path = join_path($config->base_path, 'plugin');
$config->request_vars = $vars;
$config->site = $config->queries->site->get_site_details();
$this->site = $config->site;
if (isset($vars->page)) {
if (ctype_digit($vars->page)) {
$page_id = $vars->page;
} else {
$page_id = $config->queries->site->find_page_id_by_name(strtolower($vars->page));
}
}
if (!isset($page_id) || !$page_id) {
$page_id = $this->site->site_home_page_id;
}
$this->page_id = $page_id;
$layout = new Layout($page_id);
$this->layout = $layout;
$layout->vars = $vars;
$content = $layout->render();
return $content;
}
示例2: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
// Essentials --------------------------------------------------------
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Content'));
$label = Widget::Label(__('Source XML'));
$input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code'));
$label->appendChild($input);
if (isset($errors->{'xml'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'xml'});
}
$fieldset->appendChild($label);
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例3: forge404
/**
* Método que redireciona para uma página personalizada de erro 404.
*/
public final function forge404()
{
$layout = new Layout();
$layout->setTitle('404 - Página não encontrada');
$view = new View();
$view->render("errors/404", $layout);
}
示例4: actionAddComent
public function actionAddComent()
{
$this->view = new View($this->params, PATH_VIEW_COMENT, 'add-coment_tpl.php', false);
$this->html->add('content', $this->view->render());
$layout = new Layout($this->html->getArray());
$layout->get();
}
示例5: _initLayout
/**
* @param int $type
* @param int $count
* @param int $level
* @param Layout $previousLayout
* @return Layout
*/
protected function _initLayout($type, $count, &$level, $previousLayout = null)
{
$layout = new Layout();
$layout->setLevel($level);
for ($i = 0; $i < $count; $i++) {
$_neuron = Factory::neuron($type, $i);
$_neuron->setLayout($layout);
$_neuron->hash();
if (isset($previousLayout)) {
/** @var Neuron $prevNeuron */
foreach ($previousLayout->neuronGenerator() as $prevNeuron) {
$_relation = new Relation($prevNeuron, $_neuron);
//Init relation and add neurons there
//Set relation to neurons
$_neuron->addRelation($_relation, Relation::MISTAKE);
//reverse
$prevNeuron->addRelation($_relation, Relation::SIGNAL);
//direct
}
}
$layout->addNeuron($_neuron);
}
$level++;
return $layout;
}
示例6: renderHtml
public function renderHtml($layout = FALSE, $engine = FALSE, $engineObject = FALSE)
{
$this->init();
$this->setPages();
$layout = new Layout($layout, $this->pages, $engine, $engineObject);
return $layout->getHTML();
}
示例7: actionEditProfile
public function actionEditProfile()
{
$this->view = new View($this->session->getAllParams(), PATH_VIEW_AUTHOR, 'edit-profile_tpl.php', false);
$this->html->add('content', $this->view->render());
$layout = new Layout($this->html->getArray());
$layout->get();
}
示例8: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js'));
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$field_groups = $options = array();
foreach ($this->driver->getMemberSections() as $section) {
$source = $section->{'api-source'};
$field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
if (!isset($options[$source])) {
$options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array());
}
$options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label = Widget::Label(__('Section'));
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach ($this->driver->getMemberSections() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例9: __construct
function __construct(Layout $main, $onlyBlocks = null)
{
$this->main = $main;
$this->onlyBlocks = $onlyBlocks;
if ($main->served() !== null) {
$this->served = $main->servedResponse();
$this->served->isServed = true;
}
}
示例10: testToHtml
/**
* @covers Rvi\Html\Layout\Layout::toHtml
*/
public function testToHtml()
{
$this->object->addContent("phpunit-test");
$this->object->addContent("another line");
$strHtml = $this->object->toHtml();
$this->assertContains("<html", $strHtml);
$this->assertContains("phpunit-test", $strHtml);
$this->assertContains("another line", $strHtml);
$this->assertContains("</html>", $strHtml);
}
示例11: putOnMap
/**
* method puts scalebar onto map
*
* @param Layout $layout
*/
public function putOnMap($layout = null)
{
$this->setLogoLayout($layout);
$worldMap = $this->_map->getWorldMap();
$widthPx = $worldMap->getWidth();
$equatorPixelsPerKm = $widthPx / self::$earthCircumference;
$scale = $this->_calculateScale();
$label = $this->_findOutWhichLabel($scale, $equatorPixelsPerKm);
$this->_layout->putImage($this->_map, $this->_createScaleBarMap($label, $this->_calculateLengthOfScaleBar($label, $scale, $equatorPixelsPerKm)));
}
示例12: getFile
static function getFile($id)
{
$l = new Layout();
$l->getByID($id);
if ($l->layout_file != "") {
return $l->layout_file;
} else {
return 0;
}
}
示例13: install
public function install($id)
{
$dir = FROG_ROOT . '/public/themes/' . $id . '/';
$files = $this->scan_directory_recursively($dir, 'php');
$data = array();
$data['name'] = $id;
// Layouts
$layouts = array();
$l = array();
// Snippets
$snippets = array();
$s = array();
foreach ($files as $file) {
switch ($file['name']) {
case 'layouts':
foreach ($file['content'] as $layout) {
$layouts[] = $layout['name'];
$l['name'] = Themr::theme_name($layout['name']);
$l['content_type'] = 'text/html';
$l['content'] = file_get_contents($layout['path']);
$layout = new Layout($l);
if (!$layout->save()) {
Flash::set('error', __('Layout has not been added. Name must be unique!'));
}
}
break;
case 'snippets':
foreach ($file['content'] as $snippet) {
$snippets[] = $snippet['name'];
$s['name'] = $snippet['name'];
$s['filter_id'] = '';
$s['content'] = file_get_contents($snippet['path']);
$snippet = new Snippet($s);
if (!$snippet->save()) {
Flash::set('error', __('Snippet has not been added. Name must be unique!'));
}
}
break;
}
}
// Serialize Layout and Snippet names
$data['layout'] = serialize($layouts);
$data['snippet'] = serialize($snippets);
// Get Current Theme Info
$theme_info = Themr::findTheme($id);
// Save into Themr database table
$theme = new Themr($data);
if (!$theme->save()) {
Flash::set('error', __('Theme has not been added. Name must be unique!'));
redirect(get_url('plugin/themr'));
} else {
Flash::set('success', __('Theme <b>:name</b> has been added!', array(':name' => $theme_info['name'])));
redirect(get_url('plugin/themr'));
}
}
示例14: render
/**
* Método responsável por renderizar a view.
* @param string $viewName Título da view.
* @param Layout $layout Objeto com as opções de layout.
*/
protected function render($viewName, Layout $layout)
{
$this->_viewFileName = $viewName;
$layoutFilePath = "../app/views/layout/layout.phtml";
$this->_layout = $layout;
if ($layout->getEnableLayout() && file_exists($layoutFilePath)) {
require_once $layoutFilePath;
} else {
$this->getContent();
}
}
示例15: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'));
$layout = new Layout();
$column_1 = $layout->createColumn(Layout::SMALL);
$column_2 = $layout->createColumn(Layout::SMALL);
$column_3 = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$label = Widget::Label(__('Section'));
$options = array();
foreach (new SectionIterator() as $section) {
$options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$column_1->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Processing Options'));
$label = Widget::Label(__('Filter Rules'));
$filters = $this->parameters()->filters;
if (!is_array($filters)) {
$filters = array();
}
$options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
###
# Delegate: AppendEventFilter
# Description: Allows adding of new filter rules to the Event filter
# rule select box. A reference to the $options array is provided, and selected filters
Extension::notify('AppendEventFilter', '/blueprints/events/', array('selected' => $filters, 'options' => &$options));
$label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
$fieldset->appendChild($label);
$label = Widget::Label();
$input = Widget::Input('fields[output-id-on-save]', 'yes', 'checkbox');
if ($this->parameters()->{'output-id-on-save'} == true) {
$input->setAttribute('checked', 'checked');
}
$label->appendChild($input);
$label->appendChild(new DOMText(__('Add entry ID to the parameter pool in the format of $this-name-id when saving is successful.')));
$fieldset->appendChild($label);
$column_2->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach (new SectionIterator() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$column_3->appendChild($fieldset);
$layout->appendTo($wrapper);
}