Magento Widget显示在CMS页面区域外,停止显示CMS页面文本(?)

时间:2014-03-26 16:15:33

标签: php magento widget magento-1.6

继我之前的帖子之后,我创建了一个简单的“你好世界”。样式小部件解析google-docs托管的excel csv并从数据中打印一个表 - 这部分工作得非常好,但当我将其插入CMS页面时,它显示在'面包屑&#39下面的顶部;阻止,你可以看到一个例子here,其中两组测试文本应该在表格之前和之后。

请告诉我哪些代码对发布有用,我不想发布所有内容并创建一面文字!

这是我的块php文件,它只调用(我认为)一个模板文件来完成所有解析。

<?php
class Urbanrider_Scooterlistwidget_Block_Table
extends Mage_Core_Block_Abstract
implements Mage_Widget_Block_Interface
{
    protected function _Construct() {       

    $this->setTemplate('urbanrider/scooterlistwidget/table.phtml');

}

} ?&GT;

这是正确的方法吗?它实际上是一个“Hello World&#39;窗口小部件。

编辑:

我也尝试过使用&#39; protected function toHtml()&#39;并将所有的phtml模板放在那里,但我遇到了同样的问题

2 个答案:

答案 0 :(得分:1)

你在cms中做了类似的事情:

(test before)
{{block type="urbanrider/scooterlistwidget" block_id="myblock" template="urbanrider/scooterlistwidget/table.phtml"}}
(test after)

答案 1 :(得分:0)

你也可以像这样在块类中设置模板:

<?php
class Urbanrider_Scooterlistwidget_Block_Table
extends Mage_Core_Block_Abstract
implements Mage_Widget_Block_Template
{
    protected function _toHtml() {       

    $this->setTemplate('urbanrider/scooterlistwidget/table.phtml');
    return parent::_toHtml();

}
相关问题