Wiki

Articles in category "tips", sorted by ratingX
Displaying 31-40 of 141 result(s).

FORM with GET method causes repeated stacking of URL Parameters

Created 7 months ago by Kartik VTips2 comments – viewed 4,238 times – ( +30 / -4 ) – version all
You are using an ActiveForm in yii (both v1.x or 2), with a GET method like below:

Ajax update

Created 4 years ago by zaccariaTips2 comments – viewed 42,521 times – ( +21 / -2 ) – version 1.1
Often happens to have the need of change a part of the page with ajax.
tags: AJAX

A simple action for CJuiAutoComplete

Created 3 years ago by tydeas_drTips9 comments – viewed 29,827 times – ( +16 / -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?

Activating Bootstrap 3 Tooltips & Popover for your Yii Site.

Created 7 months ago by Kartik VTips5 comments – viewed 10,176 times – ( +29 / -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?

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

Created 3 years ago by MukkeTips1 comment – viewed 23,400 times – ( +10 ) – version 1.1
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.

Locking your Yii 2 project package versions with composer.lock

Created 7 months ago by Kartik VTips0 comments – viewed 1,626 times – ( +28 / -4 ) – version 2.0
Ok, you have installed a Yii 2 basic or advanced app for the first time and completed the post install steps. You have picked up a few extensions to install for the first time as well. You would already see a composer.lock file in your application root folder.

Directory independent extensions

Created 4 years ago by GOshaTips3 comments – viewed 8,895 times – ( +15 / -1 ) – version 1.1
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:

Yii 2 list of path aliases available with default basic and advanced app.

Created 7 months ago by Kartik VTips0 comments – viewed 8,303 times – ( +30 / -5 ) – version 2.0
If you are coming over from Yii 1.x to Yii 2, and already read this guide, you may note that namespaces are very important in Yii 2 to identify classes. But do you know the list of seeded path aliases that come shipped with a basic or advanced app? Here is my attempt to list them.

Install specific Yii2 vendor extension & dependency without updating other packages.

Created 7 months ago by Kartik VTips0 comments – viewed 2,598 times – ( +30 / -5 ) – version 2.0
The tips here are for advanced usages of composer and its assumed you have read about using composer and have a knowledge of your vendor packages to be updated. Let's consider, you want to update only one specific yii2 vendor library, without updating all the other extension packages?

Using counters with ActiveRecord

Created 3 years ago by davi_alexandreTips8 comments – viewed 20,797 times – ( +14 / -1 ) – version 1.1
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).