0

我正在努力将我的页脚组织成列,当然我只在 local.xml 中工作,正如所有有能力的 Magento 开发人员都渴望做的那样。

在 local.xml 中,我删除了在 page.xml 和 cms.xml 中实例化的原始“ footer_links ”和“ cms_footer_links ”块。然后我引用“页脚”并实例化两个page/template_links块,将它们的模板分配给唯一的自定义 phtml 文件,这些文件只是 /theme/templates/page/template/links.phtml 的副本,但彼此命名不同(这样我就可以为这些块分配单独的 css 类以供以后格式化)。

问题是在左列的 page/template_links 块中的 3 个链接之间,“footer_col_links_left”,有一个管道符号('|')。而且,我的 cms_footer_links2 cms/block 块中创建了两个链接之后,有那个管道符号(奇怪的是,即使最后一个项目也有一个尾随管道,而 template_links 块中的第三个/最后一个链接不是这种情况上文提到的)。

这些管道是从哪里来的?任何模板文件都没有明确地回显它们,而且我不相信使用了默认的 afterText,因为对于第一个链接,我继续并为 addLink 操作方法传递了所有可能的参数,但没有任何变化。

这是代码:

<default>
    <remove name="footer_links"/>
    <remove name="cms_footer_links"/>

    <reference name="footer">
        <block type="page/template_links" name="footer_col_links_left" as="footer_links_left" template="page/template/column_links_left.phtml" before="-">
            <action method="addLink"><label>About Us</label><url>about-us</url><title>About Us</title><prepare>true</prepare><urlParams helper="core/url/getHomeUrl"/><position>1</position><liParams/><aParams/><beforeText/><afterText/></action>
            <action method="addLink" module="contacts" ifconfig="contacts/contacts/enabled"><label>Contact</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
            <action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map"><label>Site Map</label><url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
        </block>
        <block type="page/template_links" name="footer_col_links_mid" as="footer_links_mid" template="page/template/column_links_mid.phtml">
        </block>
        <block type="cms/block" name="cms_footer_links2">
            <!--
                The content of this block is taken from the database by its block_id.
                You can manage it in admin CMS -> Static Blocks
                Put Privacy Policy + Terms and Conditions here, call it "footer_links" in the backend
            -->
            <action method="setBlockId"><block_id>footer_links</block_id></action>
        </block>
        <block type="cms/block" name="cms_payment_logos">
            <!--
                The content of this block is taken from the database by its block_id.
                You can manage it in admin CMS -> Static Blocks
                Put credit card and Geotrust SSL logos here, call it "payment_logos" in the backend                 
            -->
            <action method="setBlockId"><block_id>payment_logos</block_id></action>
        </block>
    </reference>
</default>

此外,标题 top.links 之间没有管道,我看不出它们在 XML 中有什么不同。好吧,有一点不同,我也不明白它是如何工作的,那就是在 page.xml 中实例化的 page/template_links 块“top.links”如何与模板文件无关(没有 template="/page/block/template/links.php" 就像定义“footer_links”一样)。那是怎么回事?是否有与 page/template_links 块关联的默认模板?如果是这样,那是在哪里指定的?提前致谢!

4

1 回答 1

2

这些管道由 css 设置:在您提供的演示链接中,它是这一行:

.footer li { display:inline; background:url(http://demo5.magemojo.com/skin/frontend/default/default/images/bkg_pipe2.gif) 100% 60% no-repeat; padding:0 7px 0 4px; }
于 2012-04-22T09:17:36.027 回答