我创建了新的xml布局,它需要的所有phtmls并将action方法放在控制器中但我无法使它工作,因为在控制器中定义的url并不指向我之前创建的新xml布局。
确切地说,我将my_password.xml添加到布局/帐户文件夹中:
<customer_account_passwordup_index>
<update handle="customer_account"/>
<reference name="root">
<action method="setTemplate"><template>page/my_account_page.phtml</template></action>
</reference>
<reference name="my.account.wrapper">
<block type="customer/account_password" name="customer.account.password.update" template="customer/account/password_update.phtml"/>
</reference>
</customer_account_passwordup_index>
<customer_account>
<reference name="customer_account_navigation" >
<action method="addLink" translate="label" module="customer"><name>password_update</name><path>customer/account/passwordup</path><label>My Password</label></action>
</reference>
</customer_account>
<customer_account>
<reference name="header">
<action method="setTemplate">
<template>page/html/customer_account_header.phtml</template></action>
</reference>
</customer_account>
并将其添加到Customer模块的config.xml中:
<updates>
<customer module="Mage_Customer">
<file>customer.xml</file>
</customer>
<customer_account_passwordup module="Mage_Customer">
<file>account/my_password.xml</file>
</customer_account_passwordup>
</updates>
还将此添加到客户控制器:
public function passwordupAction()
{
$this->loadLayout();
$this->_initLayoutMessages('customer/session');
$this->_initLayoutMessages('catalog/session');
$this->getLayout()->getBlock('head')->setTitle($this->__('My Password'));
$this->renderLayout();
}
现在mysite.com/index.php/customer/account/passwordup/打开但它没有连接到my_password.xml布局,它会打开一些默认布局。
你有什么建议吗?
由于
答案 0 :(得分:1)
将此标记<customer_account_passwordup_index>
更改为此<customer_account_passwordup>
布局句柄的构建如下:
module_controller_action
。
在您的情况下,模块是customer
(顺便说一下,不要修改核心......为此创建模块),控制器名称为account
,操作名称为{{ 1}}。
清除缓存并开始使用。