Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Magento,如何在块中添加静态url链接_Html_Css_Xml_Magento - Fatal编程技术网

Html Magento,如何在块中添加静态url链接

Html Magento,如何在块中添加静态url链接,html,css,xml,magento,Html,Css,Xml,Magento,我一直在以编程的方式在块中添加url链接,我需要向在CMS/page下编辑的自定义页面添加url,我想通过添加如下内容将其添加到.xml文件中 <action method="addLink" translate="label title" module="catalog"> <label>My Account</label> <url helper="customer/getAccou

我一直在以编程的方式在块中添加url链接,我需要向在CMS/page下编辑的自定义页面添加url,我想通过添加如下内容将其添加到.xml文件中

<action method="addLink" 
        translate="label title" 
        module="catalog">
        <label>My Account</label>
        <url helper="customer/getAccountUrl" />
        <title>My Account</title>
</action>

我的帐户
我的帐户

上面的示例从模块中检索url,但不知道静态CMS/页面url应该使用哪些参数。请帮助我。

让我以top.links块为例来解释这一点

<block type="page/template_links" name="top.links" as="topLinks"/>
另外,用于编写此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>

条款和条件
条款
条款和条件
真的
2.

如果url的值是terms,那么这个url的完整路径是www.XXX.com/index.php/terms?此外,translate字段在action define中的用法是什么?当您看到translate=“label”module=“customer”时,这会告诉Magento,在将标记中的值显示到屏幕之前,它应该通过客户模块的data helper的translate方法传递标记中的值。在过于简化的术语中,$label_value=(字符串)$node->label;echo Mage::helper('customer')->(标签值);如果模块属性不存在,则使用核心模块。
<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>