Wiki

Articles in category "tutorials", sorted by commentsX
Displaying 41-50 of 240 result(s).

Display an AJAX tree from your DB using CTreeView

Created 5 years ago by Fran├žois GannazTutorials10 comments – viewed 50,250 times – ( +21 ) – version 1.1
This example uses a MySQL DB with a table named tree with the fields id, name, and parent_id. The parent_id will be NULL for root elements. The SQL is kept simple (no autoinc, no FK, etc).
tags: AJAX, CTreeView

RBAC Super Simple with Admin and User

Created 6 months ago by evercodeTutorials9 comments – viewed 18,757 times – ( +10 / -3 ) – version 2.0
One of the common requests I see in the forum is how to implement RBAC. While you can implement Yii 2's built-in RBAC, that might be too much for developers who are just starting with Yii 2 or have simpler needs. Sometimes you are looking for a fast solution and just want two flavors, user and admin. And even if you will eventually need more, you can use these methods as a starting point for developing your own features or move on to Yii 2's RBAC.

How to automate timestamps in ActiveRecord models

Created 6 years ago by dalipTutorials9 comments – viewed 119,450 times – ( +31 ) – version 1.1
There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:

Exporting CGridView results to CSV file

Created 3 years ago by RusAlexTutorials9 comments – viewed 35,039 times – ( +6 / -3 ) – version 1.1
A few days ago, i worked for CGridView exporting functional for my client. He asked me to create a simple exporting to a CSV file a CGridView search results.
tags: cgridview, export, csv

Creating a database-driven hierarchical Structure combined with CMenu and superfish

Created 5 years ago by thyseusTutorials9 comments – viewed 43,807 times – ( +15 ) – version 1.1
Note: Please also take a look at the newer EMenu extension. This works even better that the deprecated CDropDownMenu!
tags: menu

Events explained

Created 3 years ago by pligorTutorials9 comments – viewed 28,519 times – ( +22 / -3 ) – version 1.1
Let's see what exactly are the events in Yii!

Use shortcut functions to reduce typing

Created 6 years ago by qiangTutorials8 comments – viewed 43,749 times – ( +57 ) – version 1.1
Because Yii intends to be integrated nicely with third-party libraries, it does not define any global functions. Everything in Yii needs to be addressed with full class name or object scopes. For example, to access the current user, we need to use Yii::app()->user; to access application parameters, we need Yii::app()->params['name']; and so on. While editors like textmate can help alleviate the problem of these lengthy typings, it is worthwhile to define global shortcut functions to some commonly used method calls. They will make the application code look cleaner.

Custom Number Formatting or Decimal Separators and i18n

Created 2 years ago by c@cbaTutorials8 comments – viewed 39,293 times – ( +7 ) – version 1.1
By default, the decimal separator in php (also in mysql) is a dot (.). So when we work with floats in Yii (in calculations, validation, sql statements etc.), the decimal separator has to be a dot. If we want to use for example a comma (,) as the decimal separator, that is if we want to display numbers and enable users to enter numbers with a comma before the decimals, we have to...

CSqlDataProvider in CGridView

Created about a year ago by Kostas Apazidis (KonApaz)Tutorials8 comments – viewed 12,609 times – ( +8 ) – version 1.1
In this wiki I will show how could use a CSqlDataProvider in CGridView with specific features

Displaying, sorting and filtering HasMany & ManyMany relations in CGridView

Created 2 years ago by yJeroenTutorials8 comments – viewed 48,457 times – ( +19 ) – version 1.1
This tutorial gives you multiple options of how to fully implement showing, sorting and filtering related data in gridviews.