OPENCART 3:如何从自己的模块中插入任何页面数据?

发布于 2025-01-27 18:30:04 字数 235 浏览 4 评论 0原文

我有几个字段的模块。我想在联系页面和标题中显示这些数据。如何将此模块连接到范围以接触页面控制器?

我尝试过这样的连接:

$data['mymodule'] = $this->load->controller('extension/module/mymodule');

但是什么都没有。我需要做什么?

PS。我自己的Mudule没有模型。仅共核和语言。

I have own module with several fields. I want to show this data in contact page and in the header. How to connect this module for exemple to contact page controller?

I have tried connect it like this:

$data['mymodule'] = $this->load->controller('extension/module/mymodule');

But nothing. What I need to do?

PS. My own mudule doesn't have model. Cotroller and language only.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

硪扪都還晓 2025-02-03 18:30:04

我想,这很容易做到。但是我必须确切地弄清楚如何。

首先,我们需要连接控制器中的模块模型。然后连接通过ID所需的模块。最后,根据标准OpenCart方案,我们指定了用于从数组中输出数据的变量。

$this->load->model('setting/module');
$my_variable = $this->model_setting_module->getModule('module id');
$data['any_variable'] = $my_variable['any_variable'];

在模板中

{{ any_variable }}

As I thought, it's very easy to do. But I had to figure out exactly how.

First of all, we need to connect the modules model in the controller. Then connect the module that we need by ID. At the end, according to the standard opencart scheme, we specify variables for outputting data from the array.

$this->load->model('setting/module');
$my_variable = $this->model_setting_module->getModule('module id');
$data['any_variable'] = $my_variable['any_variable'];

In the template

{{ any_variable }}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文