Wiki articles in category Tips

Showing 121-140 of 158 items.

Adding a date range search for CGridView the easy way

Created 7 years ago by mikewalen, updated 6 years ago by mikewalen.
  1. Create an Active Record Behavior that builds the criteria for the search() method and attach it to your model
  2. Modify the search() method of the model to merge the behavior's criteria in with the rest of the searchable attributes
  3. Modify the _search form view to add the date range inputs
6 0
11 followers
Viewed: 37 398 times
Version: 1.1
Category: Tips

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 7 years ago by Rajith R, updated 6 years ago by Rajith R.

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 .

7 0
13 followers
Viewed: 51 979 times
Version: 1.1
Category: Tips

Using counters with ActiveRecord

Created 8 years ago by davi_alexandre, updated 5 years ago by marcovtwout.

Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).

11 1
17 followers
Viewed: 36 741 times
Version: 1.1
Category: Tips

Ajax update

Created 9 years ago by zaccaria, updated 9 years ago by zaccaria.

Often happens to have the need of change a part of the page with ajax.

16 2
14 followers
Viewed: 53 098 times
Version: 1.1
Category: Tips
Tags: AJAX

A simple class to use a different db for a module

Created 8 years ago by tydeas_dr, updated 8 years ago by Maurizio Domba Cerin.

What would you do if you want/need to have a different than the main database connection in an module's models?

8 0
12 followers
Viewed: 24 741 times
Version: 1.1
Category: Tips

Change buttons on our CGridView extending yii

Created 8 years ago by sensorario, updated 7 years ago by sensorario.

In this tip, I'll help you to change in few second buttons of your CGridView. I hope you like it =).

9 0
9 followers
Viewed: 32 522 times
Version: 1.1
Category: Tips

How to filter CGridView with From Date and To Date datepicker

Created 7 years ago by kiran sharma, updated 7 years ago by kiran sharma.

This artical is related to allow user to filter CGridView with date range using datepicker on submit button. Here I use Yii Cookie to preserve date in datepicker textbox after submitting the form.

9 0
26 followers
Viewed: 58 304 times
Version: 1.1
Category: Tips
9 0
15 followers
Viewed: 27 622 times
Version: 1.1
Category: Tips

Using events with CAction classes

Created 8 years ago by Antonio Ramirez, updated 8 years ago by 张 迪.

As you know, events are used by:

9 0
9 followers
Viewed: 19 513 times
Version: 1.1
Category: Tips

A simple action for CJuiAutoComplete

Created 9 years ago by tydeas_dr, updated 8 years ago by Thiago Souza.

Simple as that. I have placed this action in my extension folder like:

15 1
19 followers
Viewed: 45 137 times
Version: 1.1
Category: Tips

Styling Radio Buttons

Created 9 years ago by Steve Friedl, updated 9 years ago by Steve Friedl.

The default behavior with radio button lists is ugly, and I figured out mostly how to style them a coupla different ways. I'll used the blog tutorial example (but with my own posting modes):

10 0
9 followers
Viewed: 60 544 times
Version: 1.1
Category: Tips

Search method of a model for filters when using dates - unixtimestamp in database

Created 9 years ago by Mukke, updated 8 years ago by jwerner.

I ran into a problem and on irc we worked it out. Since there is a lack on information on filters in genral i thought i'd start sharing all my findings, might be usefull for other people.

10 0
11 followers
Viewed: 32 628 times
Version: 1.1
Category: Tips

Directory independent extensions

Created 9 years ago by GOsha, updated 9 years ago by GOsha.

Many people want to use downloaded extensions in their own way. As for me most of the extensions require me to correct Yii::import() instructions inside their source code. All these extensions are directory dependent. To avoid the situation described above, I suggest to implement pseudo-anonymous aliases:

// take the curr...
16 1
7 followers
Viewed: 14 249 times
Version: 1.1
Category: Tips

CGridView: Update/create records in a CJuiDialog

Created 8 years ago by Joblo, updated 7 years ago by Joblo.

My article Display the full record in a CJuiDialog uses ajax to view a record in dialog on clicking the 'view-icon'.

12 0
26 followers
Viewed: 53 479 times
Version: 1.1
Category: Tips

Configuring PhpStorm IDE for Yii 2

Created 2 years ago by CeBe, updated a year ago by CeBe.

There are a few settings and plugins that can enhance the development experience with Yii in PHPStorm or IntelliJ IDEA. This article explains how to get the most out of your IDE.

12 0
6 followers
Viewed: 28 249 times
Version: 2.0
Category: Tips

The complete beginner's study guide for the Yii Framework

Created 7 years ago by Rodrigo Coelho, updated 7 years ago by Rodrigo Coelho.

Start studying the MVC pattern. You will understand the roles of the model, the view and the controller and know where goes each part of the code.

12 0
19 followers
Viewed: 104 493 times
Version: 1.1
Category: Tips

PHPStorm & NetBeans autocomplete problem

Created 7 years ago by Stageline, updated 7 years ago by Stageline.

The problem: If you type Yii::app()->user<ctrl+space> code completion didn't work. This solve it.

12 0
14 followers
Viewed: 18 186 times
Version: 1.1
Category: Tips

Display a nice exception message on ajax requests

Created 8 years ago by Maurizio Domba Cerin, updated 8 years ago by Maurizio Domba Cerin.

in Yii versions previous to 1.1.9 exceptions was handled differently during ajax request and displayed by CApplication::displayException(). This way the exception message displayed on ajax requests could not be customized.
The message for the CGridView delete request with YII_DEBUG set to true l...

12 0
19 followers
Viewed: 44 093 times
Version: 1.1
Category: Tips

Customizing Yii's formatting rules (extending CFormatter)

Created 8 years ago by Haensel, updated 8 years ago by Haensel.

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)...

12 0
6 followers
Viewed: 20 039 times
Version: 1.1
Category: Tips

Real Time Logging

Created 9 years ago by lucifurious, updated 9 years ago by lucifurious.

I've seen a lot of people asking about the logging facilities in Yii and thought I'd share a nice little class I wrote that provides near real-time logging.

13 0
17 followers
Viewed: 30 659 times
Version: 1.1
Category: Tips