如何在Magento获得Block儿童?

如何在Magento获得Block儿童?,magento,Magento,我在phtml文件中,如何获取当前模板中的子块列表 $children = $this->getChild(); 检查app/code/Mage/Core/Block/Abstract.php中的代码 public function getChild($name = '') { if ($name === '') { return $this->_children; } elseif (isset($this->_children[$name]

我在phtml文件中,如何获取当前模板中的子块列表

$children = $this->getChild();
检查app/code/Mage/Core/Block/Abstract.php中的代码

public function getChild($name = '')
{
    if ($name === '') {
        return $this->_children;
    } elseif (isset($this->_children[$name])) {
        return $this->_children[$name];
    }
    return false;
}

因此,如果没有给出名称,它只返回所有子项。

我们也可以使用$this->getChildHtml()?有块名吗?@RIK:
$this->getChildHtml()
将返回所有子块的所有html内容。@skafandri:在我的布局xml文件中,我添加了一个子
cms/block
。然后,im是我编写的父phtml文件
$\u block=$this->getChild('block\u id')然后
$\u block->getTitle()
然后它不显示标题。。。
$\u block->getContent()
都不返回html内容。如果我尝试打印($\u块)
页面脚本就会消失。如何在phtml中获得我的cms块的标题?@MohammadFaisal我也有同样的问题。