Wiki

Articles in category "how-tos", sorted by date (updated)X
Displaying 1-10 of 355 result(s).

Using loginRequiredAjaxResponse to solve ajax session timeout

Updated about a month ago by RutgerHow-tos3 comments – viewed 26,370 times – ( +13 ) – version 1.1
This solution requires Yii 1.1.9 or above

Yii2's RBAC with three roles (admin, editor, author)

Updated 2 months ago by rashmaniHow-tos0 comments – viewed 4,340 times – ( -1 ) – version 2.0
One of my project needed roles. Needed permissions and authorizations were not complex enough to require additional plugins or extensions, I only wanted to deal with Yii. So, let's see how I did, one may find useful insights too for his/her case.

How to "masquerade" a non-required form element as 'required' one (in the view only)

Updated 2 months ago by mrunHow-tos2 comments – viewed 14,149 times – ( +7 / -1 ) – version 1.1
In a nutshell, the task at hand is to mark (or render) a model attribute in the typical "_form.php" view file with the 'required' red asterisk while this attribute is not marked as required in the model's rule() method. If you're interested only in the solution, jump ahead to the 'solution' section below.

Interactive mode command-line command for Yii1

Updated 3 months ago by TrejderHow-tos0 comments – viewed 3,194 times – version 1.1
For one of my projects I needed an interactive console command in Yii 1, i.e. the one that is gathering all information from user in an interactive mode (a serie of questions and answers displayed directly in the console), ignoring command-line arguments at all.

How to customize your grid columns visible and order by user themselves

Updated 4 months ago by Scott_HuangHow-tos0 comments – viewed 3,394 times – ( +1 ) – version 1.1
Cusomized your grid columns by user themselves, allow user to hide/show columns or re-order the columns sequences.

"safe" and "unsafe" Model validators (massive assignments)

Updated 5 months ago by brianvuHow-tos4 comments – viewed 20,517 times – ( +4 / -6 ) – version 1.1
Ok, it is a little bit difficult to full understanding the unsafe validator.

How to create a criteria condition for a multiple value text search i.e a "LIKE IN"

Updated 6 months ago by tophHow-tos2 comments – viewed 33,941 times – ( +1 / -1 ) – version 1.1
This is a shortcut for adding a text search for multiple values i.e.

Yii2: How to create/develop a new extension using Composer locally without version control or Git

Updated 6 months ago by Wade ShulerHow-tos0 comments – viewed 7,275 times – ( +2 ) – version 2.0
Using a version control system, like Git, is nice. However, when building an extension from scratch and loading it via Composer, it adds a lot of pain in the butt steps. You have to commit your changes, update composer to pull them over, then notice there is an error, fix, commit, update. repeat.. I don't want all my baby steps under Git. Sure, I could edit my commit history, but c'mon. Just let me code! I will put it under version control once I get a baseline created. This guide will show you how to setup your composer.json to load a local directory (everything inside, live). You make a change, save the file, refresh the page, boom.

i18n All-in-one format and timezone conversions for date, time, timestamp and datetime.

Updated 7 months ago by Gerhard LiebenbergHow-tos3 comments – viewed 20,405 times – ( +8 / -1 ) – version 1.1
Countries sometimes change their laws pertaining to time zones and daylight saving times. This means that GMT+2 can be a different time this August compared to last August! However, by using php's DateTime class (instead of timestamps), we can do both "format" and "time zone" conversions on a single DateTime object (only 2 lines of code) for date, time, timestamp and datetime types - while php takes care of nightmares such as current and historical time zones and daylight saving times.

How to install Yii 2 advanced on a shared hosting environment

Updated 7 months ago by oligalmaHow-tos1 comment – viewed 12,518 times – ( +3 ) – version 2.0
I've read many comments that it's not possible to install Yii 2 advanced on a shared hosting environment, as it has two webroots. This is partially true.