Wiki

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

Adding Yii Search to Your Browser Search Box

Created 6 years ago by qiangTips1 comment – viewed 44,775 times – ( +28 / -1 ) – version 1.1
The official Yii project site now supports OpenSearch. This means you can customize your browser's search box to enable direct search of the content in yiiframework.com. For example, by entering a Yii class name in the browser's search box, the corresponding class API page will be shown in the browser.
tags: search

Assigning dynamic roles to a user Using yii Rights module at the time of user creation and using some special advanced features of yii rights

Created 4 years ago by Rajith RTips20 comments – viewed 43,990 times – ( +11 / -9 ) – version 1.1
After Installing Yii Users and Rights to Newly Created Yii app we have to assign dynamic roles to a user at the time of user creation .

CGridView: Display the full record (actionView) in a CJuiDialog

Created 5 years ago by JobloTips7 comments – viewed 43,914 times – ( +15 / -1 ) – version 1.1
If you show a model (with a lot of attributes) partially in a CGridView, it can be helpful when the user can take a quick look at the full record with all attributes without displaying the view as a page and afterwards returning back to the gridview.

Update two models with one view

Created 5 years ago by sensorarioTips11 comments – viewed 41,893 times – ( +10 / -3 ) – version 1.1
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
tags: database, model, view, form

An easy way to display a success page using flash messages

Created 6 years ago by qiangTips2 comments – viewed 40,957 times – ( +28 / -1 ) – version 1.1
We often need to display a success page after the user has submitted a form without problem. We may show some welcome message after a user registers a new account. There are many ways to implement this workflow. In this article, I will explain a method that exploits flash messages.

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Created 3 years ago by Kartik VTips7 comments – viewed 39,772 times – ( +39 / -5 ) – 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?

1:n relations sometimes require CDbCriteria.together

Created 5 years ago by fsbTips5 comments – viewed 39,428 times – ( +16 / -1 ) – version 1.1
There are situations in which Active Record will generate nonsense queries from what a nieve Yii user might think is reasonable code. One such situation is a CActiveDataProvider using CDbCriteria to get data from parent and 1:n child table with a condition on the child table.

A simple action for CJuiAutoComplete

Created 6 years ago by tydeas_drTips9 comments – viewed 39,388 times – ( +17 / -2 ) – version 1.1
More or less I use auto-complete field for a form. CJuiAutoComplete is a yii widget for this purposes. The common use case is to make an ajax request and retrieve a list from the database. So in this case you have to write a controller action to return you a json encoded list. What if I had a generic action to do this work for me?

Display a nice exception message on ajax requests

Created 6 years ago by Maurizio Domba CerinTips3 comments – viewed 39,096 times – ( +13 / -1 ) – version 1.1
When an exception is thrown in our code like
tags: error, exception

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

Created 2 years ago by Scott_HuangTips3 comments – viewed 38,502 times – ( -1 ) – version 2.0
We will leverage Yii2-excelview widget. So, first of all is install Yii2-excelview: