Home >Backend Development >PHP Tutorial >Learn YII2 framework from scratch (4) Extension plug-in yii2-kartikgii, yii2yii2-kartikgii_PHP tutorial
Today I discovered a useful plug-in yii2-kartikgii. It is an expansion based on the series of plug-ins kartik-v.
Plug-in introduction
The main function of this plug-in is to help you generate kartik-gird when using gii to generate code curd. There is no need to manually add kartik-gird every time after generating code with the default gii tool. This is exactly the function I want. Quickly generate kartik-grid.
Before learning this plug-in, you may need to know about the yii2-gird plug-in: portal
Plug-in installation and configuration
Look directly at the plug-in URL:
http://www.yiiframework.com/extension/yii2-kartikgii/
Plug-in trial
This plug-in happens to be used in a project, and I tried the code generated by the plug-in.
The result page generated after accessing is as follows:
It is worth mentioning that Kartikgii is basically fully compatible with yii2-gird.
It includes the very practical function "Floating Header", which allows the data table field names to be always displayed at the top of the browser when you browse multiple data.
The effect is similar to the fixed line beginning in Excel.
Bugs and fixes
In the process of using the plug-in, after the code is generated, an error will be reported when accessing CRUD's index.php.
After tracing the code, I found a small BUG. The author wanted to comment out a section of code in the CRUD method template that comes with the framework. But the comment symbol used is "//",
The generated code only commented out one line, and several other lines were not commented out, so an error was reported. I manually modified the generated code template.
A bug was discovered and the plug-in author was notified as soon as possible to fix the bug. It can be used normally now.
Custom template
In fact, after installing the plug-in, you can modify these files in the plug-in file as shown:
By modifying these template files, the generated code can be customized. It is recommended to back up beforehand.