讓我以top.links塊爲例來說明這一點。
<block type="page/template_links" name="top.links" as="topLinks"/>
「addLink」函數在Mage_Page_Block_Template_Links中定義。該功能的定義是
public function addLink($label, $url='', $title='', $prepare=false, $urlParams=array(),
$position=null, $liParams=null, $aParams=null, $beforeText='', $afterText='')
此外,其中的html代碼寫入的phtml文件是'page/template/links.phtml'。
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link">
<action method="addWishlistLink"></action>
</block>
</reference>
回答你的問題很簡單。
假設我們需要添加一個新的鏈接到頂部鏈接,可以說一個名爲條款和條件的CMS頁面的鏈接。要做到這一點打開一個佈局文件,讓說customer.xml並添加以下代碼:
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Terms and Condition</label>
<url>terms</url>
<title>Terms and Condition</title>
<prepare>true</prepare>
<position>2</position>
</action>
</reference>
</default>
如果URL的值是計算,那麼這一個的完整路徑www.XXX.com/index.php /條款?此外,翻譯領域在行動中的用法定義如何? – 2014-11-26 02:41:34
當您看到translate =「label」module =「customer」時,這會告訴Magento它應該在