Wiki

Articles in category "tutorials", sorted by viewsX
Displaying 71-80 of 249 result(s).

Use shortcut functions to reduce typing

Created 7 years ago by qiangTutorials8 comments – viewed 47,957 times – ( +58 ) – 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.

How to use ldap in UserIdentity for authentication

Created 6 years ago by BeerSercTutorials15 comments – viewed 47,782 times – ( +14 ) – version 1.1
Yii does not have an LDAP class itself, but its very easy to implement LDAP in the stock UserIdentity class.

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

Created 6 years ago by thyseusTutorials9 comments – viewed 47,284 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

A simple way to get Yii client-side form validation run when submitting by ajax

Created 3 years ago by nlacTutorials5 comments – viewed 44,544 times – ( +8 / -2 ) – version 1.1
A time ago i've met the issue that Yii doesn't run any client-side form validation when submitting the form by CHtml::ajaxSubmitButton. The small javascript below helps to fix it.

How to log changes of ActiveRecords?

Created 7 years ago by pfthTutorials7 comments – viewed 43,853 times – ( +40 / -2 ) – version 1.1
A simple and effective way to keep track what your users are doing within your application is to log their activities related to database modifications. You can log whenever a record was inserted, changed or deleted, and also when and by which user this was done. For a CActiveRecord Model you could use a behavior for this purpose. This way you will be able to add log functionality to ActiveRecords very easily.
tags: Logging

RBAC Super Simple with Admin and User

Created about a year ago by evercodeTutorials10 comments – viewed 43,718 times – ( +15 / -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.

Drills : Search by a HAS_MANY relation in Yii 1.1

Created 3 years ago by softarkTutorials13 comments – viewed 43,526 times – ( +33 ) – version 1.1
Sometimes we get lost trying to search by a HAS_MANY relation using CActiveRecord or CActiveDataProvider in Yii 1.1. This article is a series of drills that try to describe the practical techniques of searching by a HAS_MANY relation.

Exporting CGridView results to CSV file

Created 4 years ago by RusAlexTutorials9 comments – viewed 42,898 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

Beginner / Intro Tutorials (please add to / update this list)

Created 6 years ago by Ivo RoperTutorials1 comment – viewed 41,129 times – ( +5 ) – version 1.1
This is a central location to collect links to "Getting Started" documentation beyond the blog demo and Creating First Yii Application. Please help the community by adding general, introductory links and descriptions to this page.

Simplified meta tags

Created 6 years ago by Y!!Tutorials5 comments – viewed 39,331 times – ( +13 ) – version 1.1
If we want to set meta tags on a per page (controller-action) basis, we may use the clientScript application component.