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

Display an AJAX tree from your DB using CTreeView

Created 5 years ago by Fran├žois GannazTutorials10 comments – viewed 52,297 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 about a year ago by evercodeTutorials9 comments – viewed 30,691 times – ( +12 / -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 129,605 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 38,783 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 45,722 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 31,361 times – ( +22 / -3 ) – version 1.1
Let's see what exactly are the events in Yii!

Send mail using YiiMail extension

Created 2 years ago by RKATutorials9 comments – viewed 53,912 times – ( +8 ) – version 1.1
Let me show a simpe example to send mail using YiiMail extension in 5 steps. It also includes any template view if required along with the content.
tags: YiiMail

Use shortcut functions to reduce typing

Created 6 years ago by qiangTutorials8 comments – viewed 45,732 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 3 years ago by c@cbaTutorials8 comments – viewed 44,128 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 15,860 times – ( +8 ) – version 1.1
In this wiki I will show how could use a CSqlDataProvider in CGridView with specific features