magento 將分類的圖片,放到頂部顯示 - 將下面的信息,放到頂部顯示

block是按照順序依次而來,依次畫出來

如果想將某個部分的數據搞到頂部顯示,而且這個數據是內容部分計算出來的,那麼可以用下面的方式解決

 

 

1. 在 layout/template.phtml 文件的後面加上

<block type="core/text_list" name="page_header_top"  >

你想要這個部分在哪裏顯示,就加到哪裏,我是在頂部的菜單下面,因此我是在  

messages的下面添加的

 

2.template/columns-left.phtml 

breadcrumbs後面加入
<?php echo $helper->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就可以了

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章