Wiki

Articles in category "tips", sorted by viewsX
Displaying 61-70 of 154 result(s).

Add model validator in Controller

Created 3 years ago by Kostas Apazidis (KonApaz)Tips4 comments – viewed 17,982 times – ( +1 / -2 ) – version 1.1
There are cases that model validators should be depended by controller/action and you couldn't manipulate on the model class or using scenarios in easy way

Easy way to redirect http:\\localhost\yii2-basic to http:\\localhost\yii2-basic\web\index.php

Created 3 years ago by Scott_HuangTips0 comments – viewed 17,854 times – ( +3 / -4 ) – version 2.0
First of all, install yii2 basic template according below link:

Managing constants easily

Created 6 years ago by briiC.lvTips4 comments – viewed 17,761 times – ( +4 / -1 ) – version 1.1
For time to time i have models with constants (basicly status constants) which i use in diferent places and if these constant changes, i have to change mentions of constant in code elsewhere.

How to change GridView delete confirmation message for specific controllers only?

Created about a year ago by AlaFalakiTips1 comment – viewed 17,751 times – ( +2 / -1 ) – version 2.0
Hello, If you want to give extra attention for some specific delete actions and you don't want to override whole yii.confirm JS method here is what you can do: (I've only put the ActionColumn part of the GridView here to just give you the idea)

Customizing Yii's formatting rules (extending CFormatter)

Created 6 years ago by HaenselTips0 comments – viewed 17,601 times – ( +14 / -1 ) – version 1.1
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model). When using CDetailView we would usually make use of PHPs implode function to create a simple string value of all values in the $product->tags array.

Adding a link to a CDataColumn

Created 4 years ago by le_topTips6 comments – viewed 17,600 times – ( +3 / -1 ) – version 1.1
Backoffice Grid Views often list information like Posts for a blog while showing at the same time linked information like the User who wrote that post. For more efficiency, it is appropriate that the User is displayed as a link to the User detail page.

Extending CActiveForm for some form display fixes and language tweaks

Created 7 years ago by TrejderTips0 comments – viewed 17,547 times – ( +5 / -1 ) – version 1.1
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.

BootProgressColumn - Progress Bar Inside GridView Column compatible with 'bootstrap' extension

Created 5 years ago by LuizTips1 comment – viewed 17,264 times – ( +7 / -1 ) – version 1.1
A little hint of how to create a progress bar inside the column of the grid, using the 'bootstrap' extension.

Key web server settings after installing a fresh Yii 2 basic or advanced app

Created 3 years ago by Kartik VTips2 comments – viewed 16,579 times – ( +48 / -1 ) – version 2.0
So, you have installed a brand new Yii 2 app (basic) or (advanced). Here are a few tips for Apache web server users to get things running more secure and better with your yii2 app.

Auto TDD - How to auto-run PHPUnit

Created 6 years ago by imeheszTips3 comments – viewed 16,519 times – ( +3 / -2 ) – version 1.1
If you are lucky enough and have the privilege to develop on a Linux based environment, this little tip might boost-up your TDD process (at least the Unit Testing part). Please note, that this should work just fine with Apple computers also, but not tested!
tags: PHPUnit, testing, TDD