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


PHP Mage_Core_Block_Template::setChild方法代码示例

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


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

示例1: 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

示例2: _createChildBlocksRecursively

 /**
  * @param Mage_Core_Block_Template $parent
  * @param $items
  */
 protected function _createChildBlocksRecursively($parent, $items)
 {
     foreach ($items as $key => $item) {
         $block = $this->getLayout()->createBlock('manapro_filtertree/item', $parent->getNameInLayout() . '_' . $key, array('item' => $item, 'filter' => $this, 'template' => 'manapro/filtertree/item.phtml', 'show_in_filter' => $this->getShowInFilter()));
         $parent->setChild($parent->getNameInLayout() . '_' . $key, $block);
         $this->_createChildBlocksRecursively($block, $item->getItems());
     }
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:12,代码来源:Filter.php

示例3: testSetGetUnsetChild

 public function testSetGetUnsetChild()
 {
     $layout = Mage::app()->getLayout();
     $this->_block->setLayout($layout);
     // regular block
     $blockOne = new Mage_Core_Block_Template();
     $nameOne = uniqid('block.');
     $blockOne->setNameInLayout($nameOne);
     $layout->setBlock($nameOne, $blockOne);
     $this->_block->setChild('block1', $blockOne);
     $this->assertSame($blockOne, $this->_block->getChild('block1'));
     // block factory name
     $blockTwo = new Mage_Core_Block_Template();
     $blockTwo->setLayout($layout);
     $blockTwo->setChild('block2', $nameOne);
     $this->assertSame($blockOne, $blockTwo->getChild('block2'));
     // anonymous block
     $blockThree = new Mage_Core_Block_Template();
     $blockThree->setIsAnonymous(true);
     $this->_block->setChild('block3', $blockThree);
     $this->assertSame($blockThree, $this->_block->getChild('block3'));
     // unset
     $this->_block->unsetChild('block3');
     $this->assertNotSame($blockThree, $this->_block->getChild('block3'));
     $this->_block->insert($blockOne, '', true, 'block1');
     $this->assertContains($nameOne, $this->_block->getSortedChildren());
     $this->_block->unsetChild('block1');
     $this->assertNotSame($blockOne, $this->_block->getChild('block1'));
     $this->assertNotContains($nameOne, $this->_block->getSortedChildren());
 }
开发者ID:relue,项目名称:magento2,代码行数:30,代码来源:AbstractTest.php


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