magento - adding and positioning a block using loc

2019-08-15 14:22发布

问题:

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



标签: magento block