我正在创建magento模块,以便它可以在2列侧边栏上显示。但是,它没有显示在右侧栏上。以下是到目前为止的进展:
config . xml
<config>
<modules>
<!--
This must exactly match the namespace and module's folder
names, with directory separators replaced by underscores
-->
<Michael_Zipcode>
<!-- The version of our module, starting at 0.0.1 -->
<version>0.0.1</version>
</Michael_Zipcode>
</modules>
<global>
<blocks>
<zipcode>
<class>Michael_Zipcode_Block</class>
</zipcode>
</blocks>
</global>
<frontend>
<layout>
<updates>
<zipcode>
<file>zipcodesidebar.xml</file>
</zipcode>
</updates>
</layout>
</frontend>
</config>
zipcodesidebar.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="right">
<block type="zipcode/filter" name="michael.zipcode" template="zipcode/enterzip.phtml"/>
</reference>
</default>
</layout>
Filter.php
<?php
class Michael_Zipcode_Block_Filter extends Mage_Core_Block_Template {
public function __construct()
{
parent::__construct();
$this->setTemplate('zipcode/enterzip.phtml');
}
public function getFilter() {
//die('ok');
return 'enter code area';
}
}?>
enterzip.phtml
<?php
echo $this->getFilter();
?>test
它应该在右侧打印输入代码区域。这个模块已经在adminhtml上显示并启用了。我希望它显示在所有的页面。谢谢。
自己解决,文件夹位置错误。用于布局和模板的文件夹应该放在base/default文件夹中,并与布局和模板文件夹合并。