[英]Prestashop module RenderView in backOffice Controller
我正在為Prestashop開發一個模塊,而當我需要一個新控制器的時候就來了。
我創建了它,沒問題,但是現在我想在其中顯示一些信息,出現了問題。
我有這個非常基本的代碼:
class PingdomProbeAdminController extends ModuleAdminController
{
public $name = "ProbeAdmin";
public function __construct()
{
$this->bootstrap = true;
$this->display = 'view';
$this->meta_title = $this->l('Create your new Probe');
$this->module = 'pingdom';
parent::__construct();
if (!$this->module->active)
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHome'));
}
public function renderView()
{
$this->tpl_view_vars = array(
);
$this->base_tpl_view = 'probeAdmin.tpl';
parent::renderView();
}
}
我明明已經probeAdmin.tpl
位於modules/pingdom/views/templates/admin/pingdom/helpers/view/probeAdmin.tpl
但是Smarty仍然抱怨Unable to load template file 'helpers/view/probeAdmin.tpl'
...
想你
您未指定版本,但無論如何:
AdminPingdomProbeController
並且文件名應具有相同的名稱AdminPingdomProbeController.php
modules/pingdom/views/templates/admin/pingdom_probe/helpers/view/probeAdmin.tpl
。 如果您在Admin
和Controller
之間使用駝峰式控制器名稱,則需要將模板文件夾小寫,並用下划線替換駝峰式。
編輯:
您還缺少renderView
方法中的return
。
return parent::renderView();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.