我只是想让一个基本的自定义小部件工作。我想我在这里设置了一些错误。这是我得到的例外:
2013-06-27T03:00:11+00:00 ERR (3):
exception 'Mage_Core_Exception' with message 'Invalid block type: Mage_Categoryproductslider_Block_Slider' in /home/sites/<url>/app/Mage.php:594
这是模块/小部件文件及其路径
app\etc\modules\PaulCodes_Categoryproductslider.xml
<?xml version="1.0"?>
<config>
<modules>
<PaulCodes_Categoryproductslider>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Cms />
</depends>
</PaulCodes_Categoryproductslider>
</modules>
</config>
app\code\community\PaulCodes\Categoryproductslider\Block\Slider.php
<?php
/**
* @author
*
*/
class PaulCodes_Categoryproductslider_Block_Slider extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface
{
/**
* Produces slider html
*
* @return string
*/
protected function _toHtml()
{
$pageTitle = '';
$headBlock = $this->getLayout()->getBlock('head');
if ($headBlock) {
$pageTitle = $headBlock->getTitle();
}
$html = '<a class="delicious" href="#" title="Add to del.icio.us">Del.icio.us</a>';
return $html;
}
}
?>
app\code\community\PaulCodes\Categoryproductslider\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<PaulCodes_Categoryproductslider>
<version>0.0.1</version>
</PaulCodes_Categoryproductslider>
</modules>
<global>
<blocks>
<PaulCodes_Categoryproductslider>
<class>PaulCodes_Categoryproductslider_Block</class>
</PaulCodes_Categoryproductslider>
</blocks>
<helpers>
<PaulCodes_Categoryproductslider>
<class>PaulCodes_Categoryproductslider_Helper</class>
</PaulCodes_Categoryproductslider>
</helpers>
</global>
</config>
app\code\community\PaulCodes\Categoryproductslider\etc\widget.xml
<?xml version="1.0"?>
<widgets>
<categoryproductslider_slider type="categoryproductslider/slider">
<name>Category Product Slider</name>
<description type="desc">A slider of products of a certain category</description>
</categoryproductslider_slider>
</widgets>