Kus*_*Kus 1 layout themes magento
我需要before通过布局更新引用调用将属性附加到块.
这是我的local.xml档案:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="content">
<block type="page/html_wrapper" name="content.footer" as="contentFooter" translate="label" after="-">
<label>Content Footer</label>
<action method="setElementId"><value>content-footer</value></action>
<action method="setElementClass"><value>clear</value></action>
</block>
</reference>
</default>
<catalog_category_default>
<reference name="breadcrumbs.container">
<action method="unsetChild"><name>category.title</name></action>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.title" template="catalog/category/title.phtml" before="content.footer"/>
</reference>
</catalog_category_default>
</layout>
Run Code Online (Sandbox Code Playgroud)
我的问题是,在content块上我创建了一个content.footer块,您可以在管理员中分配小部件.我after="-"在content.footer块上使用所以在我看来,应该总是把它放在内容块的底部,但事实并非如此.
当查看目录类别,并将其插入该category.products块中的content块时,它显示下方content.footer的块.使其工作的唯一方法是,如果我在我的内容中重新定义local.xml并包含所有子块category.products,并在之前设置before="content.footer".
所以我想为什么我不能category.products在catalog_category_default布局中使用引用并设置块的before属性,我尝试了以下内容:
<reference name="category.products">
<action method="setBefore"><value>content.footer</value></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
哪个没有影响.
我也注意到这个setAttribute()函数Mage_Core_Block_Abstract看到它只是一个包装器,setData()但我想我会尝试它,但仍然没有:
<reference name="category.products">
<action method="setAttribute"><key>before</key><value>content.footer</value></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
有可能做我想要的吗?之前/之后是否仅适用于同一参考中的块?
布局更新按布局更新句柄的顺序处理.你的块是最后加入到内容,但只为defaultLUH.在此句柄之后处理其他句柄(catalog_product_view,catalog_category_layered等).
如果你真的需要一个内容脚注无处不在,要确保它是里面的最后一件事内容 DIV,你应该将块添加到根的节点default handle和定制根模板(直属page/,例如page/1column.phtml通过添加)getChildHtml('your.block')通话后getChildHtml('content')打电话.这将确保您的块始终位于内容块的末尾.
| 归档时间: |
|
| 查看次数: |
7283 次 |
| 最近记录: |