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


PHP Mage_Core_Block_Template::toHtml方法代码示例

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


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

示例1: wrapPageElement

 /**
  * Wrap each element of a page that is being rendered, with a block-level HTML-element to highlight it in VDE
  *
  * Subscriber to event 'core_layout_render_element'
  *
  * @param Varien_Event_Observer $observer
  */
 public function wrapPageElement(Varien_Event_Observer $observer)
 {
     if (!$this->_getSession()->isDesignEditorActive()) {
         return;
     }
     if (!$this->_wrappingRenderer) {
         $this->_wrappingRenderer = Mage::getModel('Mage_DesignEditor_Block_Template', array('template' => 'wrapping.phtml'));
     }
     $event = $observer->getEvent();
     /** @var $layout Mage_Core_Model_Layout */
     $layout = $event->getData('layout');
     $elementName = $event->getData('element_name');
     /** @var $transport Varien_Object */
     $transport = $event->getData('transport');
     $block = $layout->getBlock($elementName);
     $isVde = $block && 0 === strpos(get_class($block), 'Mage_DesignEditor_Block_');
     $manipulationAllowed = $layout->isManipulationAllowed($elementName) && !$isVde;
     $isContainer = $layout->isContainer($elementName);
     if ($manipulationAllowed || $isContainer) {
         $elementId = 'vde_element_' . rtrim(strtr(base64_encode($elementName), '+/', '-_'), '=');
         $this->_wrappingRenderer->setData(array('element_id' => $elementId, 'element_title' => $layout->getElementProperty($elementName, 'label') ?: $elementName, 'element_html' => $transport->getData('output'), 'is_manipulation_allowed' => $manipulationAllowed, 'is_container' => $isContainer, 'element_name' => $elementName));
         $transport->setData('output', $this->_wrappingRenderer->toHtml());
     }
     /* Inject toolbar at the very beginning of the page */
     if ($elementName == 'after_body_start') {
         $elementHtml = $transport->getData('output');
         $toolbarHtml = $layout->renderElement('design_editor_toolbar');
         $transport->setData('output', $toolbarHtml . $elementHtml);
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:37,代码来源:Observer.php

示例2: manejandobloquesAction

 public function manejandobloquesAction()
 {
     $block_1 = new Mage_Core_Block_Text();
     $block_1->setText('Original Text');
     $block_2 = new Mage_Core_Block_Text();
     $block_2->setText('The second sentence.');
     $main_block = new Mage_Core_Block_Template();
     $main_block->setTemplate('nofrills/manejandobloques.phtml');
     $main_block->setChild('the_first', $block_1);
     $main_block->setChild('the_second', $block_2);
     $block_1->setText('Wait , I want this text instead .');
     echo $main_block->toHtml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:13,代码来源:IndexController.php

示例3: searchConfigAction

 public function searchConfigAction()
 {
     if ($this->getRequest()->isPost()) {
         $result['error'] = 0;
         $query = $this->getRequest()->getPost('query');
         if (!empty($query)) {
             $configs = Mage::app()->getConfig()->getNode($query);
             $items = array();
             Magneto_Debug_Block_Config::xml2array($configs, $items, $query);
             $block = new Mage_Core_Block_Template();
             //Is this the correct way?
             $block->setTemplate('debug/configsearch.phtml');
             $block->assign('items', $items);
             echo $block->toHtml();
         } else {
             $result['error'] = 1;
             $result['message'] = 'Search query cannot be empty.';
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:20,代码来源:IndexController.php

示例4: viewLogAction

 /**
  * Return last 100 lines of log file
  *
  * @return string
  */
 public function viewLogAction()
 {
     $file = $this->getRequest()->getParam('file');
     if (!empty($file)) {
         $result = Mage::helper('debug')->getLastRows(Mage::getBaseDir() . '/var/log/' . $file, 10);
         if (!is_array($result)) {
             $result = array($result);
         }
         $block = new Mage_Core_Block_Template();
         //Is this the correct way?
         $block->setTemplate('debug/logdetails.phtml');
         $block->assign('title', 'Log details : ' . $file);
         $block->assign('items', $result);
         echo $block->toHtml();
     }
 }
开发者ID:rafal-kos,项目名称:magneto-debug,代码行数:21,代码来源:IndexController.php

示例5: testToHtml

 /**
  * @covers Mage_Core_Block_Template::_toHtml
  * @covers Mage_Core_Block_Abstract::toHtml
  * @see testAssign()
  */
 public function testToHtml()
 {
     $this->assertEmpty($this->_block->toHtml());
     $this->_block->setTemplate(uniqid('invalid_filename.phtml'));
     $this->assertEmpty($this->_block->toHtml());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:11,代码来源:Template.php


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