Hyii2 background management system-menu, hyii2 Background Management System
Yii (yii-china.com)-hyii2 background management system-menu
Introduction
How to add a new menu in the hyii2 background management system? Many children's shoes that buy source code are often asked, and the menu I created is not displayed on the left-side menu bar. So today I will write this article to introduce how to configure the menu.
Add route
1. First, create a new controller, such as TestController, which has an index method (as shown below)
<?phpnamespace backend\controllers;use Yii;use yii\web\Controller;class TestController extends Controller{ public function actionIndex() { return $this->render('index'); } }
Note: I will not post the corresponding views code, so I will simply render the page.
2. Go to System Management> route management. The following page is displayed. Add the two routes to the right. (If NO route is found, click the refresh button on the right and refresh the page)
As shown above, our route is added to the available route set so that the menu can be allocated to us.
Create menu
1. Create a level 1 menu "test menu", add anything, and save it directly (at this time, the menu we created will not appear on the left)
2. create a Level 2 menu "test sub-menu", select "test menu" for the parent level (the matching will be automatically retrieved if you enter Chinese), and add the route "test/index ", save the settings (for a super account, you can see the menu)
3. Add one sentence here. If it is not a super account, you must add the corresponding menu permissions to the user to see the "test menu" on the left.
Other configurations
1. Menu sorting:
Take "test menu" as an example. In the menu management, find "test menu", click "edit menu", and enter the sorting number (from small to large = top to bottom) in the ing options ), in this way, the menu can be sorted, as shown in
2.Menu icon:
The menu icon uses the font-awesome-4.4.0 icon, so you can search for the code of the icon online and add it to the level 1 menu in json format (for example, test menu) as shown in
So we can add the menu.
Menu demonstration