Wiki

Articles in category "how-tos", sorted by viewsX
Displaying 31-40 of 355 result(s).

Using filters with CGridView and CArrayDataProvider

Created 5 years ago by marcovtwoutHow-tos33 comments – viewed 70,007 times – ( +22 ) – version 1.1
Using filters on CGridView with CActiveDataProvider is easy, but with CArrayDataProvider it is a bit tricky.

Pjax on ActiveForm and GridView - Yii2

Created 2 years ago by SreenadhHow-tos6 comments – viewed 69,257 times – ( +11 ) – version 2.0
Here is a example on how to use Pjax with GridView (yii\grid\GridView) and ActiveForm (yii\widgets\ActiveForm) widgets in Yii2.

Local time zones and locales

Created 5 years ago by Russell EnglandHow-tos9 comments – viewed 68,943 times – ( +14 / -2 ) – version 1.1
Following on from international dates, I also wanted times in the local timezone and format. This was a little more tricky but I think I've got a solution. This is only really appropriate if you have an international app.

How to translate and do the translations the easy way

Created 5 years ago by Roman SolomatinHow-tos3 comments – viewed 66,100 times – ( +28 / -2 ) – version 1.1
I wanted to keep all the I18N related translations in separate files, so that I would not need to modify the view files or the model files every time I need to update or fix the translations of application's source language.

How to setup RBAC with a php file

Created 6 years ago by bettorHow-tos17 comments – viewed 63,652 times – ( +26 / -5 ) – version 1.1
In this cookbook I will attempt to explain how to use the lightweight version of Role-Based Access Control using a php file. This version does not use database but a php file and is controlled by CPhpAuthManager class.

How to log and debug variables using CWebLogRoute

Created 6 years ago by Antonio RamirezHow-tos8 comments – viewed 63,025 times – ( +18 ) – version 1.1
I have seen a couple of articles about how to integrate external libraries to debug our PHP code (i.e. firePHP) but after you read this article you will realize that there is no need for such libraries when using Yii.
tags: Logging

Using standard filters in CGridView custom fields

Created 6 years ago by GOshaHow-tos4 comments – viewed 61,698 times – ( +17 ) – 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:

Using setFlash for displaying various kind of messages

Created 6 years ago by TrejderHow-tos6 comments – viewed 61,547 times – ( +4 / -5 ) – version 1.1
In this short how-to I will show how to customize setFlash() to display messages (flashes) styled to be success confirmation, error report or notice information. And how to achieve displaying errors in other way.
tags: flash, error, message

Displaying image in a CGridView column.

Created 4 years ago by sirin kHow-tos5 comments – viewed 61,223 times – ( +13 / -1 ) – version 1.1
This is a simple example of how we can display images in CGridviews.Imagine that you have an image field in your table ie either a location field or a blob type field used to store the images.
tags: CGridView, image

Creating a Dependent Dropdown From Scratch in Yii2

Created 2 years ago by ThePr0f3550rHow-tos4 comments – viewed 60,990 times – ( +8 ) – version 2.0
I have read http://www.yiiframework.com/wiki/24/creating-a-dependent-dropdown/ (Dependen Dropdown Yii1), but I cant implementation in Yii2 because Yii2 not built-in AJAX functionality hem.. I am search about it and get this statement