magento - adding and positioning a block using local.xml

三世轮回 提交于 2019-12-24 05:47:15

问题


I have a template in

 app\design\frontend\base\default\template\dir\template.phtml

that look like this

<div class='block block-list'>  
    <div class='block-title'><strong><span>Some Block</span></strong></div>
        <div class='block-content'>  
            &nbsp;<?php echo "my content"; ?>
        </div>
    </div>

I positioned the block on the catalog page by adding the following code to the local.xml file. However is it possible to position the block to the top of the column at the same time?

 <?xml version="1.0"?>
 <layout version="0.1.0">    
      <catalog_category_default translate="label"> 
       <reference name="right">
         <block  type="core/template" 
            name="somename"
            template="dir/template.phtml" />
      </reference>
     </catalog_category_default>    
 </layout>

follow up on https://stackoverflow.com/posts/15736207/edit


回答1:


Code for Positioning a CMS Block (layout xml file)

<block type="cms/block" before="-" name="left.permanent.callout">
<block type="cms/block" before="some-other-block" name="left.permanent.callout">
<block type="cms/block" after="-" name="left.permanent.callout">
<block type="cms/block" after="some-other-block" name="left.permanent.callout">

Using before and after attribute it is possible to change the block order...

some-other-block is the block's name attribute

http://www.magentocommerce.com/knowledge-base/entry/controlling-block-order



来源:https://stackoverflow.com/questions/15777278/magento-adding-and-positioning-a-block-using-local-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!