Wiki articles in category Tips

Showing 141-160 of 162 items.

Adding a date range search for CGridView the easy way

Created 11 years ago by mikewalen, updated 10 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: 42 090 times
Version: 1.1
Category: Tips
9 0
15 followers
Viewed: 32 082 times
Version: 1.1
Category: Tips
14 0
20 followers
Viewed: 77 227 times
Version: 1.1
Category: Tips

Using jQuery UI 1.8.10 themes with Yii 1.1.6

Created 13 years ago by a110y, updated 13 years ago by samdark.

When using the latest stable jQuery UI themes (1.8.10) with Yii 1.1.6 (which uses 1.8.6) the widgets don't appear (they're invisible but they're there). In order to make them visible you need to change the following line:

2 0
2 followers
Viewed: 23 280 times
Version: 1.1
Category: Tips

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Created 9 years ago by Kartik V, updated 6 years ago by alrazi.

Step 1: Initialize the Bootstrap Tooltip & Popover plugins in your view layout file @web\views\layouts\main.php. Add this to somewhere in the beginning head section (after you have loaded the Jquery using your AppAsset or something similar).

3 3
48 followers
Viewed: 65 584 times
Version: 2.0
Category: Tips

Using cache in CActiveDataProvider

Created 12 years ago by Stamm, updated 12 years ago by Stamm.

First param in CActiveDataProvider could be a string with model name or instance of class. So, you may use CActiveRecord::cache() for cache, but you need set third param to 2, because you should cache 2 queries: counting and get data.

17 0
11 followers
Viewed: 27 839 times
Version: 1.1
Category: Tips

Saving files to a blob field in the database

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

As a follow-up from the How to upload a file using a model wiki entry that explains how to save a file to the filesystem, this article will do the same using a blob field in the database.

6 2
17 followers
Viewed: 79 574 times
Version: 1.1
Category: Tips

An easy way to use escopes and CActiveDataProvider

Created 13 years ago by Rafael Garcia, updated 13 years ago by Rafael Garcia.

Often used scopes to define criteria in our models. This is a very useful feature as it ensures that in any part of application applying the criteria defined by the scope when called it.

1 1
10 followers
Viewed: 36 887 times
Version: 1.1
Category: Tips

Using CJuiDialog to edit rows in a CGridView

Created 12 years ago by Russell England, updated 12 years ago by Russell England.

I used Zaccarias excellent article as the base http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/

Solution

First follow the wiki above to create all the required code. Then make the following modifications in your...

3 1
11 followers
Viewed: 41 377 times
Version: 1.1
Category: Tips

Using counters with ActiveRecord

Created 12 years ago by davi_alexandre, updated 9 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: 44 629 times
Version: 1.1
Category: Tips

A simple action for CJuiAutoComplete

Created 13 years ago by tydeas_dr, updated 12 years ago by Thiago Souza.

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

15 1
19 followers
Viewed: 49 045 times
Version: 1.1
Category: Tips

Yii Security-extended guide

Created 12 years ago by bingjie2680, updated 12 years ago by bingjie2680.

This article is called extended guide is because there is already a security guide in the Yii tutorial security section. but that guide is not complete in the sense that it does not rise the developers' attention to some other commonly happening attacks: SQL injection and magic URL, which can be major vulnerabilities in you...

6 6
12 followers
Viewed: 30 650 times
Version: 1.1
Category: Tips

An Easy Solution for Dependent dropDownList Using AJAX

Created 11 years ago by mrs, updated 10 years ago by Kostas Apazidis (KonApaz).

Sometimes new Yii guys face problem to manage dependent dropDownList using AJAX. I am going to discuss an easy solution about this issue.

7 1
24 followers
Viewed: 102 050 times
Version: 1.1
Category: Tips

Special $variables in CGridView and CListView

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

The popular [CListView] and [CGridView] widgets each take a data provider and iterate over each data object produced, calling the user's code to render each row one at a time, and most are familiar with the use of the $data variable to represent the current model object or array.

23 1
33 followers
Viewed: 77 272 times
Version: 1.1
Category: Tips

CGridView: Update/create records in a CJuiDialog

Created 12 years ago by Joblo, updated 11 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: 57 537 times
Version: 1.1
Category: Tips

Update two models with one view

Created 12 years ago by sensorario, updated 11 years ago by SebK.

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

9 3
13 followers
Viewed: 55 456 times
Version: 1.1
Category: Tips

CGridView: Render customized/complex datacolumns

Created 12 years ago by Joblo, updated 11 years ago by Joblo.

If you have to display a overview of related data in a table, you can use the CListView, create your view with table/tr/td tags and implement db-queries in the view to display detaildata of the current (master-)record.

53 0
74 followers
Viewed: 168 153 times
Version: 1.1
Category: Tips
Tags: CGridView

Guidelines for good schema design

Created 12 years ago by Steve Friedl, updated 5 years ago by softark.

Virtually all Yii applications are built on top of a database, and though Yii is very flexible in how it addresses your DB, some design choices make things more convenient than others.

124 0
71 followers
Viewed: 121 578 times
Version: 1.1
Category: Tips

How to filter CGridView with From Date and To Date datepicker

Created 11 years ago by kiran sharma, updated 11 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: 63 264 times
Version: 1.1
Category: Tips

Configuring PhpStorm IDE for Yii 1.1

Created 13 years ago by samdark, updated 6 years ago by samdark.
  • Complete code: Ctrl+Space.
  • Show method arguments: Ctrl+Q.
59 1
53 followers
Viewed: 152 674 times
Version: 1.1
Category: Tips
Tags: IDE, PhpStorm