2015-03-13 94 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