OpenCart 管理菜单链接网址

2022-01-02 00:00:00 url hyperlink php opencart

我是 OpenCart 的新手,我正在尝试为它制作一个模块.

I'm verry new to OpenCart and I'm trying to make a module for it.

我希望在管理菜单中有一个指向我正在创建的模块的链接,因此我编辑了这个文件:

I want a link in the admin menu to the module I am creating thus I've edited this file:

/admin/view/template/common/header.tpl

我添加的代码:

<li><a class="top">Import / Export</a>
    <ul>
        <li><a href="" target="_blank">Link 1</a></li>
        <li><a href="" target="_blank">Link 2</a></li>
        <li><a href="" target="_blank">Link 3</a></li>
    </ul>
</li>

我的问题可能非常简单:

My question is propably verry simple:

在普通链接中,<a href=""> 的 url 设置如下:

In the normal links the url for the <a href=""> is set like this:

<a href="<?php echo $report_customer_online; ?>">

如何使用 OpenCart 的令牌制作正确模块的网址?

模块路径为module/order_export.

如果您需要更多信息,请随时询问...

If you need more info, feel free to ask...

推荐答案

在这里查看我的答案:https://stackoverflow.com/a/16418443/598500 - 我已经回答了非常相似的问题,无论如何答案与您的问题相同.

Check my answer here: https://stackoverflow.com/a/16418443/598500 - I have answered for the very similar question, anyway the answer is the same as for Your question.

但为了更准确地指导您:

But to guide You more precisely:

语言文件/admin/language//common/header.php添加例如:

language file /admin/language/<YOUR_LANGUAGE>/common/header.php add e.g.:

$_['text_my_module'] = 'My Module Title';

控制器文件 /admin/controller/common/header.php 添加例如:

controller file /admin/controller/common/header.php add e.g.:

$this->data['text_my_module'] = $this->language->get('text_my_module');

$this->data['my_module'] = $this->url->link('module/order_export', 'token=' . $this->session->data['token'], 'SSL');

最后模板文件/admin/view/template/common/header.tpl添加:

and finally the template file /admin/view/template/common/header.tpl add:

<a href="<?php echo $my_module; ?>" class="top"><?php echo $text_my_module; ?></a>

在适用的情况下...

这是你的正确答案吗?

相关文章