模板未加载到 magento 自定义模块中
template is not loading in magento custom module
我正在为前端定制 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>
你有没有检查执行是否到达你的模板文件。
执行
die('here');
声明在你的模板文件中,看看它是否到达那里。如果不是,则可能是您在此处分配的模板路径有问题。
<block type="warehouse/location_list" name="warehouse_location" template="gaboli/warehouses.phtml" />
其他代码似乎没问题。
回复你进入的位置。
希望这会有所帮助。
我正在为前端定制 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>
你有没有检查执行是否到达你的模板文件。
执行
die('here');
声明在你的模板文件中,看看它是否到达那里。如果不是,则可能是您在此处分配的模板路径有问题。
<block type="warehouse/location_list" name="warehouse_location" template="gaboli/warehouses.phtml" />
其他代码似乎没问题。
回复你进入的位置。
希望这会有所帮助。