Home >Backend Development >PHP Tutorial >Learn YII2 framework from scratch (4) Extension plug-in yii2-kartikgii, yii2yii2-kartikgii_PHP tutorial

Learn YII2 framework from scratch (4) Extension plug-in yii2-kartikgii, yii2yii2-kartikgii_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:20:351073browse

Learn YII2 framework from scratch (4) Extension plug-ins yii2-kartikgii, yii2yii2-kartikgii

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/866657.htmlTechArticleLearning the YII2 framework from scratch (4) Extension plug-ins yii2-kartikgii, yii2yii2-kartikgii I found a good one today The plug-in yii2-kartikgii is used. It is an expansion based on the series of plug-ins kartik-v. Insert...
Statement:
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