栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在opencart中创建自定义管理页面?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在opencart中创建自定义管理页面?

OpenCart 2.x

路径名称在OpenCart 2中已更改-您将要创建

admin/controller/extension/module/hello.php admin/language/en-gb/extension/module/hello.php admin/view/template/extension/module/hello.tpl

然后路线变成

admin/index.php?route=extension/module/hello

OpenCart 1.x

  • 包括完整的MVC流。

我发现了如何做到这一点。OpenCart使用MVC模式。我建议阅读有关如何成为OpenCart
Guru的内容?有关了解系统工作原理的文章-此Admin工作流也应足以满足客户需求。

1)在中创建一个新文件

admin/controller/custom/helloworld.php

您的文件名和控制器名称应按desc顺序相同:

helloworld.php

<?class ControllerCustomHelloWorld extends Controller{     public function index(){     // VARS     $template="custom/hello.tpl"; // .tpl location and file        $this->load->model('custom/hello');        $this->template = ''.$template.'';        $this->children = array( 'common/header', 'common/footer'        );   $this->response->setOutput($this->render());    }}?>

2)在中创建一个新文件

admin/view/template/custom/hello.tpl

Hello.tpl

<?php echo $header; ?><div id="content"><h1>HelloWorld</h1><?phpecho 'I can also run PHP too!'; ?></div> <?php echo $footer; ?>

3)在中创建一个新文件

admin/model/custom/hello.php

<?phpclass ModelCustomHello extends Model {    public function HellWorld() {        $sql = "SELECt x FROM `" . DB_PREFIX . "y`)";         $implode = array();        $query = $this->db->query($sql);        return $query->row['total'];        }       }?>

4)然后,您需要启用插件以避免权限被拒绝错误:

Opencart > Admin > Users > User Groups > Admin > Edit

选择并启用访问权限。

要访问您的页面,请访问

**www.yoursite.com/opencart/admin/index.php?route=custom/helloworld**



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/452181.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号