dongzhiyi2006 2015-03-03 08:28
浏览 117

Opencart - 当我在Layouts中选择它时,模块不会出现

I want to create a Div in anypage so that I can use Jquery on it

This is my catalog/controller/module/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();
}

}

And this is my catalog/view/theme/default/template/module/test_products.tpl

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

But when I turn it on in Layouts, my DIV does not appear. What did I do wrong ? I think my controller is not working...

  • 写回答

1条回答 默认 最新

  • doupingzhi9674 2015-10-07 13:18
    关注

    As i think that you have mentioned $data on return, but there is no code under $data variable. so either you will remove $data variable or assign value on it.

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

    I think it will help you.

    Thanks, with regards.

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算