mycncart后台如何新增页面

首先来增加菜单导航

进入admin/language/zh-CN/common/menu.php

增加$_['text_stock_warning']               = '菜单名';

进入admin/controller/common/menu.php

增加

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

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

进入admin/view/common/menu.tpl

增加

  • 菜单增加完成


    接着增加页面

    新建Controller文件--------------------------------------------------------------admin/controller/localisation/stock_warning.php

    class ControllerLocalisationStockWarning extends Controller {
    private $error = array();

    public function index() {
    $this->load->language('localisation/stock_warning');

    $this->document->setTitle($this->language->get('heading_title'));

    $this->load->model('localisation/stock_warning');

    $this->getList();
    }


    protected function getList() {
    $data['breadcrumbs'] = array();
    $data['breadcrumbs'][] = array(
    'text' => $this->language->get('text_home'),
    'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
    );
    $data['breadcrumbs'][] = array(
    'text' => $this->language->get('heading_title'),
    'href' => $this->url->link('localisation/stock_warning', 'token=' . $this->session->data['token'], 'SSL')
    );
    $data['header'] = $this->load->controller('common/header');
    $data['column_left'] = $this->load->controller('common/column_left');
    $data['footer'] = $this->load->controller('common/footer');
    $this->response->setOutput($this->load->view('localisation/stock_warning.tpl', $data));
    }
    }

    新建model文件--------------------------------------------------------------admin/model/localisation/stock_warning.php

    class ModelLocalisationStockWarning extends Model {
    public function export(){
    return 'hello OpenCart!';
    }
    }

    新建view文件--------------------------------------------------------------admin/view/template/localisation/stock_warning.tpl



      


    新建语言文件--------------------------------------------------------------admin/language/zh-CN/localisation/stock_warning.php

    $_['heading_title']    = '新增页面';

    页面新增完成


    修改管理员页面权限,刷新页面,大功告成


    你可能感兴趣的:(mycncart)