2014-07-02 113 views
0

我创建了新的xml布局,它需要的所有phtmls并将操作方法​​放在控制器中,但是我无法工作,因为在控制器中定义的url不指向新的xml布局我以前做过。添加新的页面布局 - Magento

为了精确,我添加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> 

和加入的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(); 
} 

now mysite.com/index.php/customer/account/passwordup/打开但它不是con nected到my_password.xml布局,它打开一些默认布局。

你有什么建议吗?

感谢

回答

1

更改此标记<customer_account_passwordup_index>这一个<customer_account_passwordup>
布局手柄是这样构建的:

module_controller_action
在你的情况下,模块是customer(顺便说一句,不要修改核心...为此创建一个模块),控制器名称为account,操作名称为passwordup

清除缓存,并给它一个去。

+0

非常感谢,救命恩人:) –