我在自己的客户模块中创建了一个新块,这是 config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Nauba_Customer>
<version>1.6.2.0.3</version>
</Nauba_Customer>
</modules>
<global>
<resources>
<nauba_customer_setup>
<setup>
<module>Nauba_Customer</module>
</setup>
</nauba_customer_setup>
</resources>
<blocks>
<nauba_customer>
<class>Nauba_Customer_Block</class>
</nauba_customer>
<customer>
<rewrite>
<form_register>Nauba_Customer_Block_Form_Register</form_register>
</rewrite>
</customer>
</blocks>
<models>
<customer>
<rewrite>
<customer>Nauba_Customer_Model_Customer</customer>
</rewrite>
</customer>
</models>
</global>
<frontend>
<routers>
<customer>
<args>
<modules>
<Nauba_Customer before="Mage_Customer">Nauba_Customer</Nauba_Customer>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
现在我试图在主页中调用它,所以我在 page.xml 布局中指定了它:
<!-- this is only the home page section -->
<page_homepage translate="label">
<label>Homepage</label>
<reference name="root">
<!--reference name="head">
<action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/styles-ie.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/widgets.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/print.css</name></action>
</reference-->
<block type="page/html" name="category_links" template="page/html/category_links.phtml" />
<block type="cms/block" name="homepage_slider_image_1" as="homepage_slider_image_1">
<action method="setBlockId"><block_id>homepage_slider_image_1</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_2" as="homepage_slider_image_2">
<action method="setBlockId"><block_id>homepage_slider_image_2</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_3" as="homepage_slider_image_3">
<action method="setBlockId"><block_id>homepage_slider_image_3</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_4" as="homepage_slider_image_4">
<action method="setBlockId"><block_id>homepage_slider_image_4</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_1" as="homepage_event_banner_1">
<action method="setBlockId"><block_id>homepage_event_banner_1</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_2" as="homepage_event_banner_2">
<action method="setBlockId"><block_id>homepage_event_banner_2</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_3" as="homepage_event_banner_3">
<action method="setBlockId"><block_id>homepage_event_banner_3</block_id></action>
</block>
<block type="nauba_customer/list_ordercrosssell" name="ordercrosssell" as="ordercrosssell" template="nauba_customer/list/ordercrosssell.phtml">
</block>
<action method="setTemplate"><template>page/home.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
<action method="setLayoutCode"><name>page_homepage</name></action>
</reference>
</page_homepage>
但是当我在主模板中调用它时它不起作用:
($this->getChildHtml('ordercrosssell'))
我也尝试通过以下方式创建它:
$this->getLayout()->createBlock('ordercrosssell')
但它会引发此异常“无效块类型”。有什么帮助吗?