【问题标题】:Opencart - Module does not appear when I choose it in LayoutsOpencart - 当我在布局中选择它时,模块不会出现
【发布时间】:2015-05-03 19:55:29
【问题描述】:

我想在任何页面中创建一个 Div,以便我可以在其上使用 Jquery

这是我的目录/控制器/模块/test_products.php

class ControllerModuleTestProducts extends Controller {
public function index() {
    $this->document->addScript('catalog/view/javascript/test.js');
    $path = '/template/module/test_products.tpl';
    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $path)) {
        $this->template = $this->config->get('config_template') . $path;
    } else {
        $this->template = 'default'.$path;
    }
    return $this->load->view($this->template, $data);
    //$this->render();
}

}

这是我的目录/视图/主题/默认/模板/模块/test_products.tpl

<div id="test-notification" class="abc"></div>

但是当我在 Layouts 中打开它时,我的 DIV 没有出现。我做错了什么 ?我认为我的控制器无法正常工作...

【问题讨论】:

  • 有同样的问题..
  • 您使用的是什么 Opencart 版本?为什么$this-&gt;render(); 在你的代码中被注释掉了?

标签: php jquery layout module opencart


【解决方案1】:

我认为您在返回时提到了 $data,但 $data 变量下没有代码。因此,您要么删除 $data 变量,要么为其赋值。

return $this->load->view($this->template, $data);

我想它会对你有所帮助。

谢谢,问候。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-14
    • 1970-01-01
    • 2011-08-08
    • 1970-01-01
    • 2016-05-02
    相关资源
    最近更新 更多