商派BBC系统——会员中心左侧标签嵌套右侧页面方法

84 阅读1分钟

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

商派BBC系统——会员中心左侧标签嵌套右侧页面方法

新增左侧菜单标签方法: 修改文件 config/usermenu.php

return array(
	.....
	.....
	.....,
	array(
        'label' => '测试',
        'items' => array(
            array(
            'label' => '测试-index',
            'action'=>'topc_ctl_test@index'    // 在路由文件必须添加此方法路由信息,否则报错
            ),
            array('label' => '测试-add','action'=>'topc_ctl_test@add'),
        ),
    ),
);

bootstrap/routes.php

.....
.....
......
/*测试*/
route::group(array(), function() {

    route::get('member-test-index.html', [ 'as' => 'what', 'uses' => 'topc_ctl_test@index' ]);
    route::get('member-test-add.html', [ 'as' => 'what', 'uses' => 'topc_ctl_test@add' ]);
});

效果图 这里写图片描述

调用页面方式

$this->action_view  //此参数的作用是html页面文件名
最终输出页面情调用 $this->output();

custom/topc/controller/test.php

class topc_ctl_test extends topc_ctl_member {

    public function index()
    {
        $pagedata = array();
        $this->action_view = "test/index.html";

		// 使用$this->output()函数必须继承topc_ctl_member 
        return $this->output($pagedata);
    }

    public function add()
    {

    }
}

html页面 custom/topc/view/member/test/index.html

Index Page

效果图

这里写图片描述