国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
How to solve the problem that the sub-level of the left menu of yii2 cannot be highlighted, yii2 menu sub-menu
Home Backend Development PHP Tutorial How to solve the problem that the sub-level of the left menu of yii2 cannot be highlighted, yii2 menu sub_PHP tutorial

How to solve the problem that the sub-level of the left menu of yii2 cannot be highlighted, yii2 menu sub_PHP tutorial

Jul 12, 2016 am 08:53 AM
yii2 menu Highlight

How to solve the problem that the sub-level of the left menu of yii2 cannot be highlighted, yii2 menu sub-menu

Let’s take a look at the specific problem first.
Adding a role belongs to the role menu. How to make the role menu selected when performing the operation of adding a role?
The Create, View and other actions of adminlte's left navigation cannot locate the index module (the left secondary navigation cannot be expanded and positioned)
If you follow our tutorial above, then the problem to be explained next should not be a problem. Let’s first take a look at how we handled the left menu menu

use mdm\admin\components\MenuHelper; 
<&#63;php 
$callback = function($menu){ 
 //鑒于篇幅有限,這里的代碼省略,源碼見于原文
}; 
//這里我們對(duì)一開始寫的菜單menu進(jìn)行了優(yōu)化
echo dmstr\widgets\Menu::widget( [ 
 'options' => ['class' => 'sidebar-menu'], 
 'items' => MenuHelper::getAssignedMenu(Yii::$app->user->id, null, $callback), 
] ); &#63;>

Seeing this, we might as well open the file dmstrwidgetsMenu to see how to implement left menu selection, a problem that has troubled many students.

protected function isItemActive($item)
{
 if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
  //......
  if ($arrayRoute[0] !== $arrayThisRoute[0]) {
   return false;
  }
  if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
   return false;
  }
  if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
   return false;
  }
  //......
  return true;
 }
 return false;
}

Look, look at the code above, that is to say, the menu on the left is activated when the current route is completely equal to the menu route.

In view of the two questions we talked about at the beginning that many friends were confused about, we only need to slightly adjust the code here to determine whether the control is controlled by the controller instead of the action. However, we cannot modify the source code file. What should we do? Woolen cloth? When the weather is hot, serve it cold.

Here we copy the dmstrwidgetsMenu.php file to backendcomponentsMenu.php, and then modify the isItemActive method as follows

protected function isItemActive($item)
{
 if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
  
  //......


  //改寫了路由的規(guī)則,是否高亮判斷到controller而非action
  $routeCount = count($arrayRoute);
  if ($routeCount == 2) {
   if ($arrayRoute[0] !== $arrayThisRoute[0]) {
    return false;
   }
  } elseif ($routeCount == 3) {
   if ($arrayRoute[0] !== $arrayThisRoute[0]) {
    return false;
   }
   if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
    return false;
   }
  } else {
   return false;
  }


  // if ($arrayRoute[0] !== $arrayThisRoute[0]) {
  //  return false;
  // }
  // if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
  //  return false;
  // }
  // if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
  //  return false;
  // }
  
  //......
  
  return true;
 }
 return false;
}

You’re done, now the Menu file referenced by our left menu is modified to point to backendcomponentsMenu

use backend\components\Menu;
echo Menu::widget([
 'options' => ['class' => 'sidebar-menu'],
 'items' => MenuHelper::getAssignedMenu(Yii::$app->user->id, null, $callback),
]); 

Let’s go try it and see if our problem is solved.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1123780.htmlTechArticleHow to solve the problem that the sub-level of the left menu of yii2 cannot be highlighted. Let’s take a look at the specific problems of the yii2 menu first. . Adding a role belongs to the role menu. How to add a role...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Windows 11: The easy way to import and export start layouts Windows 11: The easy way to import and export start layouts Aug 22, 2023 am 10:13 AM

In Windows 11, the Start menu has been redesigned and features a simplified set of apps arranged in a grid of pages, unlike its predecessor, which had folders, apps, and apps on the Start menu. Group. You can customize the Start menu layout and import and export it to other Windows devices to personalize it to your liking. In this guide, we’ll discuss step-by-step instructions for importing Start Layout to customize the default layout on Windows 11. What is Import-StartLayout in Windows 11? Import Start Layout is a cmdlet used in Windows 10 and earlier versions to import customizations for the Start menu into

How to Default 'Show More Options' in Windows 11's Right-Click Menu How to Default 'Show More Options' in Windows 11's Right-Click Menu Jul 10, 2023 pm 12:33 PM

One of the most annoying changes that we users never want is the inclusion of "Show more options" in the right-click context menu. However, you can remove it and get back the classic context menu in Windows 11. No more multiple clicks and looking for these ZIP shortcuts in context menus. Follow this guide to return to a full-blown right-click context menu on Windows 11. Fix 1 – Manually adjust the CLSID This is the only manual method on our list. You will adjust specific keys or values ??in Registry Editor to resolve this issue. NOTE – Registry edits like this are very safe and will work without any issues. Therefore, you should create a registry backup before trying this on your system. Step 1 – Try it

Implementation steps of implementing menu navigation bar with shadow effect using pure CSS Implementation steps of implementing menu navigation bar with shadow effect using pure CSS Oct 16, 2023 am 08:27 AM

The steps to implement a menu navigation bar with shadow effect using pure CSS require specific code examples. In web design, the menu navigation bar is a very common element. By adding a shadow effect to the menu navigation bar, you can not only increase its aesthetics, but also improve the user experience. In this article, we will use pure CSS to implement a menu navigation bar with a shadow effect, and provide specific code examples for reference. The implementation steps are as follows: Create HTML structure First, we need to create a basic HTML structure to accommodate the menu navigation bar. by

How to remove the 'Open in Windows Terminal' option from the right-click context menu in Windows 11 How to remove the 'Open in Windows Terminal' option from the right-click context menu in Windows 11 Apr 13, 2023 pm 06:28 PM

By default, the Windows 11 right-click context menu has an option called Open in Windows Terminal. This is a very useful feature that allows users to open Windows Terminal at a specific location. For example, if you right-click on a folder and select the "Open in Windows Terminal" option, Windows Terminal will launch and set that specific location as its current working directory. Although this is an awesome feature, not everyone finds a use for this feature. Some users may simply not want this option in their right-click context menu and want to remove it to tidy up their right-click context menu.

How to disable the Show more options menu in Windows 11 How to disable the Show more options menu in Windows 11 Apr 13, 2023 pm 08:10 PM

More and more people are experiencing the new and improved Microsoft operating system, but it seems that some of them still prefer the old-school design. There's no doubt that the new context menu brings impressive consistency to Windows 11. If we consider Windows 10, the fact that each application has its own context menu element creates serious confusion for some people. From the Windows 11 transparent taskbar to the rounded corners, this operating system is a masterpiece. In this matter, users across the globe are interested to know how to quickly disable Windows 11 Show More Options menu. The process is pretty simple, so if you're in the same boat, make sure you check it out completely

How to remove jquery in yii2 How to remove jquery in yii2 Feb 17, 2023 am 09:55 AM

How to remove jquery from yii2: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and add the configuration "'yii" under the field "components" \web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

Tutorial on opening the new start menu in win11 Tutorial on opening the new start menu in win11 Jan 10, 2024 am 08:30 AM

As we all know, Microsoft has redone the start menu in win11 system. The new start menu is not only displayed in the center, but also changes the display mode, clears the traditional tiles, and all applications are displayed as icons, but many friends I don’t know how to turn it on, so let’s take a look with the editor. How to open the new start menu in win11 1. The start menu comes with win11, we do not need to open it manually. 2. If you find that there is no new version of the start menu after installing win11, you must have downloaded the wrong win11. 3. If you want to use this new version of the start menu, you need to re-download a win11 from this site. 4. Download Once done, just load the file and run it

How to edit messages on iPhone How to edit messages on iPhone Dec 18, 2023 pm 02:13 PM

The native Messages app on iPhone lets you easily edit sent texts. This way, you can correct your mistakes, punctuation, and even autocorrect wrong phrases/words that may have been applied to your text. In this article, we will learn how to edit messages on iPhone. How to Edit Messages on iPhone Required: iPhone running iOS16 or later. You can only edit iMessage text on the Messages app, and then only within 15 minutes of sending the original text. Non-iMessage text is not supported, so they cannot be retrieved or edited. Launch the Messages app on your iPhone. In Messages, select the conversation from which you want to edit the message

See all articles