本文共 711 字,大约阅读时间需要 2 分钟。
block是按照顺序依次而来,依次画出来
如果想将某个部分的数据搞到顶部显示,而且这个数据是内容部分计算出来的,那么可以用下面的方式解决
1. 在 layout/template.phtml 文件的后面加上
你想要这个部分在哪里显示,就加到哪里,我是在顶部的菜单下面,因此我是在
messages的下面添加的
2.template/columns-left.phtml
breadcrumbs后面加入
getModulesByPosition('page_header_top') ?>
3.在显示的顶部加入
$blockT = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'category_image_top', array('template' => 'catalog/category/view/top_image.phtml') ); $categoryImage = $current_category->getImage(); $width = 500; $height = 200; $imgUrl = $this->getCategoryImageUrl($categoryImage, $width, $height); $blockT->assign('imageUrl', $imgUrl); $this->getLayout()->getBlock('page_header_top')->append($blockT);
通过这种方式添加上block就可以了
转载地址:http://spcli.baihongyu.com/