2015-03-13 88 views
0

我正在爲前端定製magento模塊,我添加了一個頁面,但此頁面未顯示內容,請指教我,我錯了。波紋管是我的代碼:模板未加載在magento自定義模塊中

class Gaboli_Warehouse_IndexController extends Mage_Core_Controller_Front_Action 
{ 
    public function indexAction() 
    { 
     $this->loadLayout();  
     $this->renderLayout(); 
    } 
} 

塊 -

class Gaboli_Warehouse_Block_Location_List extends Mage_Core_Block_Template 
{ 

    public function __construct() 
    { 
     parent::__construct(); 
    } 
} 

佈局XML -

<?xml version="1.0"?> 
<layout version="0.1.0"> 

    <warehouse_index_index> 
     <reference name="content"> 
      <block type="warehouse/location_list" name="warehouse_location" template="gaboli/warehouses.phtml" /> 
     </reference> 
    </warehouse_index_index> 

</layout> 

回答

1

你檢查執行是否達到你的模板文件。 在您的模板文件中執行 die('here');聲明並查看它是否到達那裏。如果沒有,你可以在這裏分配模板路徑。

<block type="warehouse/location_list" name="warehouse_location" template="gaboli/warehouses.phtml" /> 

其他代碼看起來不錯。

回覆,你進入這個。

希望這會有所幫助。

+0

路徑是正確的....如果我改變了佈局xml頁面沒有任何影響。我能跟蹤控制器但不阻止。 – 2015-03-18 12:45:24

+0

在佈局xml中,默認引用正在工作,但「warehouse_index_index」不起作用 – 2015-03-18 12:57:24

+0

現在它正在工作,我將處理程序「warehouse_index_index」更改爲「gaboli_warehouse_index_index」 – 2015-03-20 07:31:15