Home Backend Development PHP Tutorial 从零开始学YII2框架(四)扩展插件yii2-kartikgii_PHP

从零开始学YII2框架(四)扩展插件yii2-kartikgii_PHP

May 31, 2016 pm 07:30 PM
yii2 Extensions

今天发现了一款好用的插件yii2-kartikgii。它是基于系列插件kartik-v的拓展。

插件介绍

这个插件主要功能是帮助你在使用gii生成代码curd的时候生成kartik-gird的。不需要每次用默认的gii工具生成代码之后再手动添加kartik-gird,这正是我想要的功能。快速生成kartik-grid。

学习这个插件之前你可能需要了解下yii2-gird插件:传送门

插件安装与配置

直接看插件网址:

http://www.yiiframework.com/extension/yii2-kartikgii/

插件试用

正好有个项目中用到了这个插件,试用了下插件生成的代码。


访问生成后的结果页面如下:

值得一提的是,Kartikgii把yii2-gird基本完全兼容了下来。

其中包括很实用的功能 "Floating Header", 此功能在你浏览多数据的时候,数据表字段名称可以一直显示在浏览器上方。

和Excel中的固定行首的效果类似。

Bug以及修复

在使用插件的过程中,生成完毕代码,访问CRUD的index.php时候,会报错。

追了下代码,发现一个小BUG,作者想把框架自带的CRUD方法模板中的一段代码注释掉。但是使用的注释符号是"//",

生成的代码只注释了一行,还有其他几行没有注释掉,所以报错。我手动修改了生成代码模板。

发现了Bug,第一时间通知了插件作者,修复了此Bug。现在能正常使用。

自定义模板

其实安装完毕插件,你可以修改插件文件中的这几个文件如图:


通过修改这几个模板文件,可以自定义生成后的代码。建议事先备份下。

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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How to install extensions on Google Chrome How to install extensions on Google Chrome Mar 11, 2024 pm 01:34 PM

How to install extensions on Google Chrome? Google Chrome is very convenient and safe to use. You can use this browser for work, entertainment or study. In this browser, you can install a variety of extension plug-ins to experience rich functions. You need to download them from the plug-in store now. good files, and then install them in Google Chrome. Many users still don’t know how to install these extensions. This site will bring you a tutorial on how to install the Google Chrome extension. I hope it will be helpful to you. Google Chrome extension plug-in installation tutorial method one: drag and drop installation 1. After downloading the plug-in first, open the extension page of the Chrome browser. 2. Navigate to "chrome://extensions/" or press Chr

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.

A few selected CTF exercises will help you learn the yii2 framework! A few selected CTF exercises will help you learn the yii2 framework! Feb 23, 2022 am 10:33 AM

This article will introduce you to the yii2 framework, share a few CTF exercises, and use them to learn the yii2 framework. I hope it will be helpful to everyone.

What should I do if Sogou Browser automatically deactivates extensions? What should I do if Sogou Browser automatically deactivates extensions? Mar 07, 2024 pm 09:20 PM

What should I do if Sogou Browser automatically deactivates extensions? Sogou Browser is very popular because of its complete functions. We are inseparable from the use of browsers in our daily lives. In addition to the functions that come with the browser, Sogou Browser can also add some extensions to help us use the browser better. However, some friends have discovered that Sogou Browser will What should I do if extensions are automatically deactivated? The editor has compiled the solutions and steps for how Sogou Browser will automatically deactivate extensions. Follow me below! What should I do if Sogou Browser automatically deactivates extensions? First, launch Sogou High-speed Browser, then find the "Show Menu" icon consisting of three horizontal lines in the upper right corner, and click it. 2. After clicking, the menu window of Sogou Browser will pop up below. In the window

Recommended free tools and extension plug-ins for developing CMS systems with PHP Recommended free tools and extension plug-ins for developing CMS systems with PHP Jun 21, 2023 pm 06:15 PM

With the development of Internet technology, many websites have turned to the development of CMS (content management system). Among them, the PHP language CMS system is loved by many developers and users because it has the advantages of open source, free, and flexibility. However, developing a CMS system requires many tools and plug-ins to help us improve efficiency and quality. This article will introduce you to some free tools and recommended extensions for developing CMS systems with PHP. 1. Recommended free tools for PHP development of CMS systems: XAMPPXAMPP is a

How to install Redis extension using YII2 framework How to install Redis extension using YII2 framework May 26, 2023 pm 06:41 PM

1. You need to download the windows version of the master branch of yii2-redis with composer 2. Unzip and copy it to vendor/yiisoft 3. Add 'yiisoft/yii2-redis'=>array('name'=>'yiisoft to extensions.php under yiisoft /yii2-redis','version'=>'2.0.

How to enable the 2345 browser extension in incognito mode How to enable the 2345 browser extension in incognito mode Jan 30, 2024 pm 03:45 PM

How can the 2345 browser allow extensions to run in incognito mode? How do you run an extended plug-in in incognito mode? Here are the detailed methods: When we use the 2345 browser, we will install a lot of extensions, but some friends have found that these extensions cannot be used in incognito mode. So how to allow the plug-ins to be used in incognito mode? How to do it specifically? The editor below has compiled the steps on how to allow extensions to run in incognito mode on the 2345 browser. If not, just follow me and read on! How to allow extensions to run in incognito mode in the 2345 browser 1. First open the 2345 browser, find the icon as shown below in the upper right corner of the browser, and click on the icon with the mouse. 2,

Extension plug-in development based on golang framework Extension plug-in development based on golang framework Jun 05, 2024 pm 02:48 PM

Extension plug-ins are tools that enhance the functionality of the GoLang framework. You can create and register plug-ins to add new functionality and behavior to your application. Plug-ins are created by implementing the MyPlugin interface, and are registered using the plugin.Register function. Practical examples include creating a custom log plug-in to handle logging requests.

See all articles