2014-07-02 158 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

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