本文整理汇总了PHP中Mage_Core_Block_Abstract::setTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Abstract::setTemplate方法的具体用法?PHP Mage_Core_Block_Abstract::setTemplate怎么用?PHP Mage_Core_Block_Abstract::setTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Block_Abstract::setTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hello
/**
* Specified by <view>hello</view>
*
* View function should return a $block, which will be automatically
* appended to the Page Layout's content block
*
* $block is a block object and will have a data member called
* params which contains the matched regular expressions from
* <url_regex/>. The $block's class is controlled by <block_class/>.
* See simplepage.xml for more information.
*
* $layout is a reference to the Magento page layout object, and
* may be used to manipulated the existing layout. (add blocks,
* unset them, change templates, etc.)
*
* $request and $response are the standard Magento request and response
* objects, in case you want to monkey with them.
*
* @param Mage_Core_Block_Abstract $block
* @param Mage_Core_Model_Layout $layout
* @param Mage_Core_Controller_Request_Http $request
* @param Mage_Core_Controller_Response_Http $response
* @return Mage_Core_Block_Template $block
*/
function hello($block, $layout, $request, $response)
{
//in this example we're just setting a template on
//the bock on returning it. Standard Magento theme
//rules apply for template loading
$block->setTemplate('pulsestorm_simplepage/example.phtml');
//$layout->getBlock('left')->getParentBlock()->unsetChild('left');
//$layout->getBlock('root')->setTemplate('page/1column.phtml');
return $block;
}
示例2: _getPlaceHolderBlock
/**
* Get Placeholder Block
*
* @return Mage_Core_Block_Abstract
*/
protected function _getPlaceHolderBlock()
{
if (null === $this->_placeholderBlock) {
$blockName = $this->_placeholder->getAttribute('block');
$this->_placeholderBlock = new $blockName();
$this->_placeholderBlock->setTemplate($this->_placeholder->getAttribute('template'));
$this->_placeholderBlock->setLayout(Mage::app()->getLayout());
$this->_placeholderBlock->setSkipRenderTag(true);
}
return $this->_placeholderBlock;
}