Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

头部添加新链接如何做?
 
vary
Member
 
Total Posts:  60
Joined:  2008-12-15
China,Hongkong
 

如图所示,要是在头部添加两个新的链接应该在哪里入手?

Image Attachments
010101.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Go FlyFish
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2009-11-29
China
 

template head.phtml maybe

 
Magento Community Magento Community
Magento Community
Magento Community
 
CosmoCommerce
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-09-05
Shanghai
 

top.links里面可以hardcode,这个是笨办法

好办法是在layout里面的通过handle来做处理.
以下代码节选自magento 1.3.2.4:

<default>

<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title” module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</default>

<!--
Load this update on every page when customer is logged in
-->

<customer_logged_in>
<reference name="top.links">
<action method="addLink" translate="label title” module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
</reference>
</customer_logged_in>

<!--
Load this update on every page when customer is logged out
-->

<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title” module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="wishlist_sidebar"></remove>
<remove name="reorder"></remove>
</customer_logged_out>

解释:
你可以通过top.links这个block来addlink.
代码就是添加label,添加url地址.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Angelobhl
Jr. Member
 
Total Posts:  2
Joined:  2009-12-28
 

写连接的时候,如果是站外连接,例如http://***.com的,建议写成
<url>http://***.com</url>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top