php如何进入管理页面,php – 如何在opencart中创建自定义管理页面?

更新

>包括完整的MVC流。

我发现如何做到这一点。 OpenCart使用MVC模式。我建议阅读关于学习如何系统工作的How to be an OpenCart Guru?帖子 – 这个管理员工作流程也应该足够客户端。

1)在admin / controller / custom / helloworld.php中创建一个新文件

您的文件名和控制器名称应按照降序排列:

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

HelloWorld

echo 'I can also run PHP too!';

?>

3)在admin / model / custom / hello.php中创建一个新文件

class 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值