Wiki

Articles in category "tips", sorted by date (updated)X
Displaying 21-30 of 149 result(s).

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

Updated 7 months ago by le_topTips0 comments – viewed 2,138 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

Updated 7 months ago by Scott_HuangTips0 comments – viewed 4,964 times – ( +2 / -3 ) – version 2.0
First of all, install yii2 basic template according below link:

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

Updated 7 months ago by Scott_HuangTips2 comments – viewed 8,806 times – version 2.0
We will leverage Yii2-excelview widget. So, first of all is install Yii2-excelview:

Add model validator in Controller

Updated 7 months ago by Kostas Apazidis (KonApaz)Tips4 comments – viewed 5,387 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

Create Form With DynamicModel

Updated 7 months ago by Misbahul D MunirTips4 comments – viewed 3,652 times – version 2.0
In yii2 we can create form without create FormModel. Here we go
tags: form, yii2, model

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Updated 8 months ago by Kartik VTips5 comments – viewed 16,989 times – ( +39 / -4 ) – version 2.0
With Bootstrap 3 and its inbuilt support in Yii Framework 2.0, you would see quite some new ways of creating HTML markup and styling your site. However, with version 3 of Bootstrap, tooltips and popover are not activated by default on your elements. Assuming you have activated the Bootstrap 3 tooltip plugin - how do you easily enable display of tooltips/popovers across your site?

embedded javascript block in your view with IDE checking or intellisense

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

Custom column in TbGridView with icon by condition, find out icon class glyphicons easy (YiiBooster)

Updated 9 months ago by Rohit SutharTips2 comments – viewed 20,553 times – ( +2 / -1 ) – version 1.1
First of all, You have to find out the class of the desired icon, so visit the http://getbootstrap.com/2.3.2/base-css.html#icons

using multiple radio button

Updated 10 months ago by Rohit SutharTips4 comments – viewed 35,801 times – ( +9 / -1 ) – version 1.1
When we use multiple radio buttons with same name in Yii many people have the problem on getting the value of the selected radiobutton. The radioButtonList can be used for that, but if we need to use radioButton itself to place the button any where in a view, we need to include one more parameter in htmloption array().

Expert's model generation with Gii

Updated 10 months ago by le_topTips0 comments – viewed 4,891 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.