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

增加<li><a href="<?php echo $order_status; ?>"><?php echo $text_order_status; ?></a></li>

菜單增加完成


接着增加頁面

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

<?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

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

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

<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
  
</div>
<?php echo $footer; ?>

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

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

頁面新增完成


修改管理員頁面權限,刷新頁面,大功告成


發佈了33 篇原創文章 · 獲贊 17 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章