商派BBC系统——商家管理管理中心的菜单配置

122 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

商派BBC系统——商家管理管理中心的菜单配置

1、配置文件目录 ./config/shop.php

在return array(.......);里面添加商家管理管理中心的菜单配置代码

return array(
	......
	......
	其他菜单配置信息
	......
	......,
	
	'test' => array(    // test -> 你打算在topshop/controller/目录下创建的文件夹
        'label' => '测试',    // 在商户后台顶部导航菜单显示的名称
        'display' => true,    // 是否显示
        'action' => 'topshop_ctl_test_index@index',    // 链接地址(填写menu数组下的第一个菜单信息action对应的值)
        'icon' => 'glyphicon glyphicon-magnet',    // 菜单图片 参考链接http://getbootstrap.com/components/
        'menu' => array(    // 子菜单
            array(
	            'label'=>'测试-Index',    // 显示的菜单名称
	            'display'=>true,    // 是否显示
				'action'=>'topshop_ctl_test_index@index',    // 链接地址 topshop_ctl_test_index 对应topshop/controller/test/index.php 文件 class topshop_ctl_test_index extends topshop_controller{public function index(){}}
				'url'=>'test/test_index.html',    // 浏览器显示的链接地址
				'method'=>'get'    // 请求方式
				),
            array('label'=>'测试-Add','display'=>true,'as'=>'topshop.test.add','action'=>'topshop_ctl_test_index@add','url'=>'test/test_add.html','method'=>'get'),
            array('label'=>'测试-Save','display'=>false,'as'=>'topshop.test.save','action'=>'topshop_ctl_test_index@save','url'=>'test/test_save.html','method'=>'post'),
        )
    ),
);

2、控制器文件地址(这里在二开目录做demo) ./custom/topshop/controller/test/index.php

class topshop_ctl_test_index extends topshop_controller{
    public function index()
    {
        $pagedata = array();
        return $this->page('topshop/test/index.html', $pagedata);
    }

    public function add()
    {
        $pagedata = array();
        return $this->page('topshop/test/add.html', $pagedata);
    }

    public function save()
    {
        $var = input::get();
        var_dump($var);
    }
}

3、模版文件目录 ./custom/topshop/view/test/index.html

Index Page

./custom/topshop/view/test/add.html

Add Page<br />
<form action="<{url action=topshop_ctl_test_index@save}>" method="post" class="form-horizontal" role="form">
    user:<input type="text" name="user">
    <input type="submit" name="save" value="save">
</form>

参考图片 Index页面 这里写图片描述 Add页面 这里写图片描述 Save页面 这里写图片描述 大家试一次,就会明白的。

提示: 1.只有下边有子菜单的导航菜单才会显示出来