【问题标题】:Add a class to UL of links.phtml lists in Magento向 Magento 中的 links.phtml 列表的 UL 添加一个类
【发布时间】:2012-07-31 12:27:28
【问题描述】:

我希望能够向列表的 UL 元素添加一个类,这些列表使用使用模板 page/template/links.phtml 的块 type="page/template_links" 输出(例如:顶部链接、页脚链接)。

有没有办法通过 XML 添加一个类? <block /> 的属性?

【问题讨论】:

    标签: php css zend-framework magento magento-1.7


    【解决方案1】:

    这可以通过对page/template/links.phtml 进行轻微修改,然后为您希望添加类的每个链接块创建一小段布局 xml 来实现。

    首先,如果您还没有这样做,请将page/template/links.phtml 复制到您的主题并在 ul 标签的 class 属性中添加以下内容:

    <?php echo $this->getClass() ?>
    

    然后,以页脚链接块为例,布局 sn-p 将如下所示(显然将 'test-class' 替换为您希望应用于 ul 的类):

    <reference name="footer_links">
        <action method="setClass"><class>test-class</class></action>
    </reference>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-09
      • 2014-03-13
      • 2013-12-27
      • 2012-02-17
      相关资源
      最近更新 更多