通过这种方式,您基本上告诉 Magento 调用由您的操作节点的父节点指定的块的方法“插入”。
(或在 app/code/core/Mage/Core/Block/Abstract.php 中)
Magento 不关心子节点的名称,只关心它们的值。
你可以在app/code/core/Mage/Core/Model/Layout.php中观看
public function generateBlocks($parent=null)
{
if (empty($parent)) {
$parent = $this->getNode();
}
foreach ($parent as $node) {
$attributes = $node->attributes();
if ((bool)$attributes->ignore) {
continue;
}
switch ($node->getName()) {
case 'block':
$this->_generateBlock($node, $parent);
$this->generateBlocks($node);
break;
case 'reference':
$this->generateBlocks($node);
break;
case 'action':
// WE GO HERE WHEN WE HAVE AN ACTION NODE
$this->_generateAction($node, $parent);
break;
}
}
}
那你看_generateAction()的时候,我就不贴所有方法了:
....
$args = (array)$node->children();
....
call_user_func_array(array($block, $method), $args);
所以,无论参数 tagName 是什么,结果都是一样的。
干杯,