Wiki

Sorted by ratingX
Displaying 11-20 of 784 result(s).

How to use a single form to collect data for two or more models?

Created 8 years ago by qiangTutorials33 comments – viewed 215,446 times – ( +118 / -3 ) – version 1.1
Assume we want to use a single HTML form to collect input for both model A and model B, and we want to display input errors (if any) in the same error summary box. We can define the following action code:

CGridView: Render customized/complex datacolumns

Created 5 years ago by JobloTips13 comments – viewed 151,147 times – ( +74 / -1 ) – version 1.1
If you have to display a overview of related data in a table, you can use the CListView, create your view with table/tr/td tags and implement db-queries in the view to display detaildata of the current (master-)record.
tags: CGridView

Understanding "Safe" Validation Rules

Created 6 years ago by Steve FriedlFAQs11 comments – viewed 121,025 times – ( +95 / -2 ) – version 1.1
A common source of confusion among new Yii users is how the 'safe' validator works, how it works with other validators, and why it's necessary in the first place. This article means to clear up this confusion, as well as explain the notion of Massive Assignment.

CJuiDialog to create new model

Created 6 years ago by zaccariaTutorials54 comments – viewed 97,331 times – ( +69 / -1 ) – version 1.1
In this tutorial we will learn how to realize a create interface using a dialog.

Relations: BELONGS_TO versus HAS_ONE

Created 6 years ago by Steve FriedlFAQs9 comments – viewed 125,737 times – ( +69 / -1 ) – version 1.1
It's very common to see new Yii users confusing the relations HAS_ONE and BELONGS_TO, and getting it wrong means you won't get proper values back. And though we'll talk about HAS_MANY as well, we're specifically omitting the MANY_MANY relation because it's a whole different animal.

Getting to Understand Hierarchical RBAC Scheme

Created 6 years ago by daemonsTutorials15 comments – viewed 99,232 times – ( +63 / -1 ) – version 1.1
Authentication and Authorization is a good tutorial. Among other topics, it describes basic aspects of Yii's RBAC implementation. But however hard I read the tutorial, I couldn't understand how exactly the hierarchy works. I found how to define authorization hierarchy, how business rules are evaluated, how to configure authManager, but almost nothing about how I should build my hierarchy, in what sequence its nodes are checked, when the checking process stops and what would be the checking result.

Understanding Virtual Attributes and get/set methods

Created 6 years ago by Steve FriedlTutorials20 comments – viewed 145,963 times – ( +80 / -2 ) – version 1.1
When you define or extend a class, you can create class variables and methods in Yii just like you can in any other PHP system:

Creating a dependent dropdown

Created 8 years ago by dalipTutorials53 comments – viewed 328,659 times – ( +112 / -4 ) – version 1.1
Often you'll need a form with two dropdowns, and one dropdown's values will be dependent on the value of the other dropdown. Using Yii's built-in AJAX functionality you can create such a dropdown.

How to work with flash messages

Created 8 years ago by pfthTutorials12 comments – viewed 277,158 times – ( +60 / -1 ) – version 1.1
Set your messages in a controller:

Update content in AJAX with renderPartial

Created 7 years ago by BurzumTutorials17 comments – viewed 262,425 times – ( +60 / -1 ) – version 1.1
The easiest way to update content in AJAX is to use the renderPartial method.
tags: AJAX