当你说
`type="cms/block"`
你告诉 Magento 创建一个 'cms/block template object, which translates to a
Mage_Cms_Block_Block` 类。如果你看看这个块的来源
#File: app/code/core/Mage/Cms/Block/Block.php
protected function _toHtml()
{
$blockId = $this->getBlockId();
$html = '';
if ($blockId) {
$block = Mage::getModel('cms/block')
->setStoreId(Mage::app()->getStore()->getId())
->load($blockId);
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$html = $processor->filter($block->getContent());
}
}
return $html;
}
你可以看到这不会渲染模板,而是渲染 Magento 的静态块对象。
尝试
`type="core/template"`
相反,并确保您的块 ID 是唯一的。