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 43,121 times – ( +28 ) – 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 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

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

Created 5 years ago by JobloTips7 comments – viewed 42,679 times – ( +15 ) – 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.

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 42,325 times – ( +11 / -8 ) – 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 .

Update two models with one view

Created 5 years ago by sensorarioTips11 comments – viewed 40,448 times – ( +10 / -2 ) – 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 5 years ago by qiangTips2 comments – viewed 38,722 times – ( +28 ) – 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.

A simple action for CJuiAutoComplete

Created 5 years ago by tydeas_drTips9 comments – viewed 37,962 times – ( +17 / -1 ) – 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?

1:n relations sometimes require CDbCriteria.together

Created 5 years ago by fsbTips5 comments – viewed 37,662 times – ( +16 ) – 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.

Display a nice exception message on ajax requests

Created 5 years ago by Maurizio Domba CerinTips3 comments – viewed 37,537 times – ( +13 ) – version 1.1
When an exception is thrown in our code like
tags: error, exception

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Created 2 years ago by Kartik VTips7 comments – viewed 35,882 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?

Putting Function To Be Called In View

Created 6 years ago by junxiongTips2 comments – viewed 35,104 times – ( +6 / -1 ) – version 1.1
Sometimes we need some complicated view to be displayed (such as generating complicated table). Most people suggest that in MVC the View must be as simple as possible (don't have too much loops, etc). So what we have to do is to hide away the complex code by putting it at somewhere else. The following are few places options to keep the function:
tags: view, render