Wiki

Articles in category "how-tos", sorted by ratingX
Displaying 61-70 of 354 result(s).

Using standard filters in CGridView custom fields

Created 6 years ago by GOshaHow-tos4 comments – viewed 63,287 times – ( +17 / -1 ) – version 1.1
In this article I'll try to explain how to use standard quick search fields in CGridView with customized columns.For example: We have a record in a database with field switch having 0 or 1 values. After that we want a user to see on or off instead 1 or 0. So we do the usual thing:

Moving project code outside of webroot (plus multiple project support)

Created 6 years ago by Steve FriedlHow-tos8 comments – viewed 50,562 times – ( +22 / -2 ) – version 1.1
Yii's by-default directory organization works well enough, but there are several steps one can take that improve the security and serviceability of the system, especially in the context of multiple Yii projects on the same machine (including multiple versions of the same project).
tags: config, security

Creating a CSS Driven Drop Down Menu using CMenu

Created 6 years ago by blindMoeHow-tos10 comments – viewed 87,705 times – ( +22 / -2 ) – version 1.1
CMenu offers great functionality and the ability to customize just about every aspect of the output. There are many times when I need to create a drop down menu or simply modify the look to make the designers happy. Because this seems to be a common task for me, I figured I would share my code to create a very simple drop down menu that other people could use.

Displaying uploaded file from DB for update with FileInput widget

Created 3 years ago by Kartik VHow-tos3 comments – viewed 35,569 times – ( +39 / -6 ) – version 2.0
This is for folks who are using \kartik\widgets\FileInput to upload files from your client. How do you display an image for update after you have uploaded it to the server using the widget?

Managing a star rating with the StarRating widget in Yii 2

Created 3 years ago by Kartik VHow-tos4 comments – viewed 11,998 times – ( +38 / -6 ) – version 2.0
In Yii 1.x, there was a built in widget CStarRating based on the jquery star rating plugin. There exists no prebuilt solution in Yii2, however the same concepts can be extended using any jquery plugin.

Kickstart development with Yii-App

Created 4 years ago by Chris83How-tos25 comments – viewed 32,031 times – ( +21 / -2 ) – version 1.1
I recently created a project called Yii-App on GitHub to kickstart my development of smaller Yii applications. The main goal of the project is to provide a ready-to-use application template that includes my bootstrap extension and many other useful extensions. After reading this article you will be able to use this project as a starting point for all of your Yii projects.

Simple authorization system

Created 5 years ago by GustavoHow-tos1 comment – viewed 34,732 times – ( +16 / -1 ) – version 1.1
How to create a simple (non-RBAC) authorization system

How to avoid multiple Ajax Request

Created 6 years ago by nickcvHow-tos26 comments – viewed 55,111 times – ( +25 / -3 ) – version 1.1
CHtml::ajaxLink(), CHtml::ajaxSubmitButton() and similar methods are great, but if they are located inside a portion of the page that is already loaded via ajax something bad will happen, something you may even not notice if you are not using tools like firebugs: the sent ajax requests will multiply themselves.

Drop down list with enum values for column of type ENUM >+> incorporate into giix

Created 5 years ago by c@cbaHow-tos4 comments – viewed 36,559 times – ( +14 / -1 ) – version 1.1
Let's say our table 'mug' has a column named 'color' of the type ENUM('red','green','blue'). We want to replace the textfield for the attribute color in the create and update forms of a 'mug' with a drop down list, which has the enum values as options. The main code was contributed by zaccaria in the forum (see this post).

How to use GridView with AJAX

Created 3 years ago by Antonio RamirezHow-tos6 comments – viewed 55,759 times – ( +14 / -1 ) – version 2.0
With the adoption of PJax on Yii2 things  have change quite a bit with GridView when it comes to work with them in AJAX mode. It will probably be confusing at the beginning, but then you will soon realize how powerful the new approach is.
tags: yii2, pjax, widget