【问题标题】:prestashop - Loading a smarty template in a tabprestashop - 在选项卡中加载 smarty 模板
【发布时间】:2017-05-11 15:40:33
【问题描述】:

我正在尝试在自定义选项卡上显示模板。

这是controllers/admin/AdminTController.php的代码:

<?php
class AdminTController extends ModuleAdminController {

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

    public function display() {

        //echo $this->l('This is admin my module tab !');
        // the echo works.
        $this->createTemplate('initial.tpl');
    }
}

这是/views/templates/admin/initial.tpl的代码:

<p>This is just a test</p>

这段代码的结果是一个空白页。这意味着模板没有加载。我做错了什么?

【问题讨论】:

    标签: php templates tabs smarty prestashop-1.6


    【解决方案1】:

    尝试使用下面提到的代码。

    <?php
    class AdminTController extends ModuleAdminController {
    
        public function __construct() {
            parent::__construct();
        }
    
        public function display() {
            $tpl = $this->custom_smarty->createTemplate('initial.tpl');
            return $tpl->fetch();
        }
    }
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-11
      相关资源
      最近更新 更多