Wiki

Articles in category "tips"X
Displaying 1-10 of 141 result(s).

Yii Rights Management Tips

Created about a month ago by Rajith RTips0 comments – viewed 1,913 times – ( +5 ) – version 1.1
yii rights some tips..

Analyse the server's USER-AGENT against browsecap file to determine it's capability.

Created about a month ago by Deepak PradhanTips0 comments – viewed 1,215 times – version 2.0
Does your application need to know user's details on browser details, os and device type? We can use PHP's misc. function to achieve that provided you have an update copy of browsercap.ini

Provide SVG when the browser supports it, else PNG (using CHtml::image overload)

Created about a month ago by le_topTips0 comments – viewed 1,383 times – ( +1 ) – version 1.1
Modern browsers support SVG, older browsers do not. This replacement for CHtml::image() allows you to handle to propose SVG in an efficient way with PNG as a fallback.

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

Created about a month ago by Scott_HuangTips0 comments – viewed 2,049 times – ( +1 / -2 ) – version 2.0
First of all, install yii2 basic template according below link:

Add model validator in Controller

Created about a month ago by KonApazTips4 comments – viewed 1,937 times – ( +1 / -1 ) – 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

Step by step for how to full export Yii2 grid to excel

Created about a month ago by Scott_HuangTips2 comments – viewed 2,810 times – version 2.0
We will leverage Yii2-excelview widget. So, first of all is install Yii2-excelview:

Create Form With DynamicModel

Created 2 months ago by Misbahul D MunirTips2 comments – viewed 2,122 times – version 2.0
In yii2 we can create form without create FormModel. Here we go
tags: form, yii2, model

embedded javascript block in your view with IDE checking or intellisense

Created 2 months ago by yiqing95Tips0 comments – viewed 1,964 times – ( +3 ) – version 2.0
this is my way for embed js code block in view file:

Expert's model generation with Gii

Created 5 months ago by le_topTips0 comments – viewed 3,511 times – ( +3 ) – version 1.1
Efficient coding with Yii implies efficient use of the code generator. This article shares the personalised Gii templates that were built starting from the standard templates proposed by AweGen.

Search scenario (CGridView, etc.): avoid default values from database as search condition.

Created 5 months ago by le_topTips1 comment – viewed 2,199 times – ( +1 ) – version 1.1
Yii has a neat "trick" that will assign default values to new CActiveRecords. When performing a search() though, this is pretty annoying as they automatically apply as filter values.