Wiki articles in category Tips

Showing 121-140 of 162 items.

Display a nice exception message on ajax requests

Created 13 years ago by Maurizio Domba Cerin, updated 13 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: 50 371 times
Version: 1.1
Category: Tips

A simple action for CJuiAutoComplete

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

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

15 1
19 followers
Viewed: 50 390 times
Version: 1.1
Category: Tips

How to use a component before every action of a controller

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

I guess this is a tip on how to execute some code before every action in a controller, because I will tell you how I did it and maybe you can use the idea in your project.

2 0
4 followers
Viewed: 51 843 times
Version: 1.1
Category: Tips

1:n relations sometimes require CDbCriteria.together

Created 13 years ago by fsb, updated 11 years ago by fsb.

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.

15 0
12 followers
Viewed: 52 858 times
Version: 1.1
Category: Tips

Putting Function To Be Called In View

Created 14 years ago by junxiong, updated 14 years ago by junxiong.

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:

5 1
5 followers
Viewed: 53 090 times
Version: 1.1
Category: Tips
Tags: render, view

Update and Delete buttons on Breadcrumb

Created 6 years ago by Daniel.

The definition of breadcrumbs according to its documentation is as follow: Breadcrumbs displays a list of links indicating the position of the current page in the whole site hierarchy.

1 0
1 follower
Viewed: 54 849 times
Version: 2.0
Category: Tips

Configuring PhpStorm IDE for Yii 2

Created 7 years ago by CeBe, updated 7 years 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.

14 0
6 followers
Viewed: 55 026 times
Version: 2.0
Category: Tips

Update two models with one view

Created 13 years ago by sensorario, updated 13 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: 57 263 times
Version: 1.1
Category: Tips

CGridView: Update/create records in a CJuiDialog

Created 13 years ago by Joblo, updated 13 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: 58 914 times
Version: 1.1
Category: Tips

An easy way to display a success page using flash messages

Created 14 years ago by qiang, updated 14 years ago by qiang.

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.

21 0
29 followers
Viewed: 59 154 times
Version: 1.1
Category: Tips

Ajax update

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

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

16 2
14 followers
Viewed: 59 665 times
Version: 1.1
Category: Tips
Tags: AJAX

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 12 years ago by Rajith R, updated 12 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: 61 618 times
Version: 1.1
Category: Tips

Quick Tip about Pagination Params

Created 14 years ago by Antonio Ramirez, updated 14 years ago by Antonio Ramirez.

Developing custom Grids and ListViews for my new CMS I was facing a small challenge: If I was to update/delete/batch delete items of my Grid, how would I return to the current page view?

5 0
8 followers
Viewed: 64 110 times
Version: 1.1
Category: Tips

FORM with GET method causes repeated stacking of URL Parameters

Created 11 years ago by Kartik V, updated 11 years ago by toph.

// In Yii 1.x $form = $this->beginWidget('CActiveForm', [

'id' => 'order-search-form',
'method' => 'get',

]); echo $form->textInput($searchModel, 'id'); echo CHtml::submitButton('Find', ['class' => 'btn btn-primary']); $this->endWidget(); `

7 2
41 followers
Viewed: 64 110 times
Version: all
Category: Tips

How to filter CGridView with From Date and To Date datepicker

Created 13 years ago by kiran sharma, updated 12 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: 64 748 times
Version: 1.1
Category: Tips
1 0
6 followers
Viewed: 65 810 times
Version: 1.1
Category: Tips

Adding Yii Search to Your Browser Search Box

Created 14 years ago by qiang, updated 7 years ago by CeBe.

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.

25 0
6 followers
Viewed: 66 679 times
Version: all
Category: Tips

htmlOptions explained for various controls.

Created 14 years ago by Woil, updated 14 years ago by Woil.

Most controls that are rendered by CHtml have an argument called $htmlOptions. This argument is an array that holds the attributes of the HTML element. For example the following code:

15 0
14 followers
Viewed: 67 094 times
Version: 1.1
Category: Tips

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Created 11 years ago by Kartik V, updated 7 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: 67 890 times
Version: 2.0
Category: Tips

Customizing the CMenu Widget

Created 11 years ago by mistryb, updated 10 years ago by mistryb.

The CMenu class provides some useful features for generating menus in your web application.

1 0
4 followers
Viewed: 69 410 times
Version: 1.1
Category: Tips