Wiki

Articles in category "how-tos", sorted by ratingX
Displaying 11-20 of 355 result(s).

Create your own Validation Rule

Created 6 years ago by nickcvHow-tos14 comments – viewed 204,906 times – ( +76 / -4 ) – version 1.1
Some times the core validation rules provided by Yii won't satisfy all your needs, so you'll need to create your very own validation rule.

Save and Display Date/Time Fields in different formats in Yii2

Created 3 years ago by Kartik VHow-tos12 comments – viewed 117,923 times – ( +41 / -1 ) – version 2.0
You would find having such a need in most Yii Projects. Your database needs a specific format to store date fields, while you may want to display it in different formats to the users on forms and other views.

Single table inheritance

Created 6 years ago by samdarkHow-tos8 comments – viewed 38,384 times – ( +41 / -1 ) – version 1.1
Relational databases do not support inheritance so if we need to represent it, we have to somehow store meta info while keeping performance by minimizing JOINs. One way to solve this problem is using single table inheritance. All fields for the whole class tree are stored in a single table. Class name is stored in the type field of the same table.

Uploading multiple images with CMultiFileUpload

Created 6 years ago by rsinghHow-tos17 comments – viewed 105,852 times – ( +38 / -1 ) – version 1.1
"The documentation for CMultiFileUpload isn't clear!"

Creating a jQueryUI Sortable CGridView

Created 6 years ago by blindMoeHow-tos23 comments – viewed 42,808 times – ( +48 / -2 ) – version 1.1
I have had to do this a couple of times now so I figured I would share it with the community. I am going to keep this short because I really hope that you are familiar with jQueryUI's Sortable class before starting this tutorial.

Managing different Bootstrap form layouts with yii2-field-range extension.

Created 3 years ago by Kartik VHow-tos0 comments – viewed 18,959 times – ( +37 / -1 ) – version 2.0
This wiki will explain how you can use the Field range extension with multiple Bootstrap form layouts (vertical or horizontal). You maybe aware, that the yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.

Actions code reuse with CAction

Created 6 years ago by Antonio RamirezHow-tos13 comments – viewed 43,275 times – ( +36 / -1 ) – version 1.1
We all know how good 'gii' automates the code for us and we normally tend to be happy with what that tool offers at the beginning of our Yii learning curve. But as soon as you start working in larger and larger projects, you realize that its code is too repetitive to maintain and having a small pitfall in general actions means to go over and over through them to fix the issues.
tags: CAction, Tutorial

Using the yii2-datecontrol extension along with yii2-detail-view widget

Created 3 years ago by Kartik VHow-tos0 comments – viewed 10,698 times – ( +35 / -1 ) – version 2.0
The yii2-datecontrol extension allows you to control separate date formats for display and saving for form inputs.

Cookie management in Yii

Created 6 years ago by TrejderHow-tos5 comments – viewed 144,793 times – ( +43 / -2 ) – version 1.1
Cookie management in Yii is easy, but may not be so obvious for the beginners to this framework, so I wrote this simple article to clear some doubts out.

Searching and Sorting by Count of Related Items in CGridView

Created 5 years ago by softarkHow-tos14 comments – viewed 46,678 times – ( +33 / -1 ) – version 1.1
Let's say we have two models and relation between them: