【问题标题】:Prestashop Back office Module - View / Smarty / Uncaught exception SmartyExceptionPrestashop 后台模块 - 查看 / Smarty / 未捕获的异常 SmartyException
【发布时间】:2016-11-04 06:26:16
【问题描述】:

我正在实施 Prestashop Back Office 模块。我在安装文件中添加了新标签

我在视图的显示上有错误消息。

我的实现中很可能缺少某些东西。

模块名称是:mydashboard

我将 tpl 文件放在文件夹 /web/modules/mydashboard/views/templates/admin/mydashboard 中

错误信息是

/var/www/clients/client2986/web12226/web/modules/mydashboard 致命错误:未捕获的异常“SmartyException”,消息“无法加载模板文件”/var/www/clients/client2986/web12226/web/admin11 /themes/default/template//var/www/clients/client2986/web12226/web/modules/mydashboard/views/templates/admin/mydashboard/dashboard.tpl'' 在 /var/www/clients/client2986/web12226/web /tools/smarty/sysplugins/smarty_internal_templatebase.php:127 堆栈跟踪:#0 /var/www/clients/client2986/web12226/web/classes/controller/AdminController.php(1152):Smarty_Internal_TemplateBase->fetch() #1 / var/www/clients/client2986/web12226/web/classes/controller/Controller.php(185): AdminControllerCore->display() #2 /var/www/clients/client2986/web12226/web/classes/Dispatcher.php( 348): ControllerCore->run() #3 /var/www/clients/client2986/web12226/web/admin11/index.php(50): DispatcherCore->dispatch() #4 {main} 抛出 /var/www /clients/client2986/web12226/web/tools/smarty/sysplugins/smarty_internal_templat ebase.php 在第 127 行

class AdminMyDashboardController extends ModuleAdminController
{
public $searchflag = 0;
public $datefrom = 0;
public $dateto = 0;
public $orderstatus = 0;
public $datalist = array();

public function __construct()
{       
    // Set variables
    $this->table = 'my_table';
    $this->className = 'MyDashboard';
    $this->actions = array('mysearchorder', 'myresetsearchorder');

    // Set context
    $this->context = Context::getContext();
    $this->context->controller = $this;

    $this->bootstrap = true;

    parent::__construct();

    $this->meta_title = $this->l('My Dashboard');
    $this->toolbar_title[] = $this->meta_title;

}


public function initContent()
{   
    parent::initContent();
    $this->loadObject(true);

    // Order List
    $this->datelist = $this->object->getDataList();     
    $this->context->smarty->assign('datalist', $this->datelist);

    //Search flag
    $this->context->smarty->assign('searchflag', $this->searchflag);


    $this->setTemplate('dashboard.tpl');        
}

public function setMedia()
{
    $sepa = DIRECTORY_SEPARATOR;

    $css_directory = $sepa.'modules'.$sepa.MyCommon::getModuleName().$sepa.'views'.$sepa.'css'.$sepa.'mydashboard.css';
    $this->addCSS($css_directory, 'all');

    $js_directory = $sepa.'modules'.$sepa.MyCommon::getModuleName().$sepa.'views'.$sepa.'js'.$sepa.'mydashboard.js';
    $this->addJS($js_directory, 'all');

    return parent::setMedia();
}

/**
* postProcess
*
* @param mixed $token
* @return void
*/


public function postProcess($token = null)
{
    $this->loadObject(true);

    parent::postProcess($token);
}

}

【问题讨论】:

    标签: php model-view-controller module smarty prestashop-1.5


    【解决方案1】:

    问题在这里 /var/www/clients/client2986/web12226/web/admin11/themes/default/template//var/www/clients/client2986/web12226/web/modules/mydashboard/views/templates/admin/ mydashboard/dashboard.tpl

    我猜你的 MyCommon::getModuleName() 返回的不是你期望在这里使用的路径。

    【讨论】:

      猜你喜欢
      • 2010-09-28
      • 2019-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多