如何让Magento的Block儿童?

ily*_*oli 11 magento

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

ily*_*oli 16

$children = $this->getChild();
Run Code Online (Sandbox Code Playgroud)

检查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;
}
Run Code Online (Sandbox Code Playgroud)

因此,如果没有给出名字,它只会返回所有孩子.