Wiki articles in category Tutorials

Showing 1-20 of 264 items.

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

Created 15 years ago by qiang, updated 11 years ago by Yang He.

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:

88 0
79 followers
Viewed: 331 867 times
Version: 1.1
Category: Tutorials

By Example: CHtml

Created 14 years ago by jonah, updated 7 years ago by glicious.

"By Example" cookbook pages will provide coding examples for many of the commonly used classes within Yii. We will try to provide as many usage examples as possible for keep these pages as helpful as possible.

79 0
74 followers
Viewed: 989 453 times
Version: 1.1
Category: Tutorials

Searching and sorting by related model in CGridView

Created 12 years ago by Maciej Liżewski, updated 9 years ago by Kostas Apazidis (KonApaz).

Lets say we have two models and relation between them:

77 0
93 followers
Viewed: 271 905 times
Version: 1.1
Category: Tutorials

Yii for beginners

Created 12 years ago by rackycz, updated 4 years ago by rackycz.

Hi. This is first article with my Yii v1 tutorial. I had to split it into 2 articles as there's limited length of texts on Wiki. So once you understand basics, you can read the 2nd article here: Yii for beginners 2.

68 0
75 followers
Viewed: 437 466 times
Version: 1.1
Category: Tutorials

Understanding Virtual Attributes and get/set methods

Created 12 years ago by Steve Friedl, updated 12 years ago by GOsha.

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:

class Comment extends CActiveRecord {
    public $helperVariable;
    public function rules() { ... }
    ...
}

and then use them in the obvious way:

$var   = $model->helperVariable;
$rules = $model->rules();

This part everybody understa...

66 0
44 followers
Viewed: 202 284 times
Version: 1.1
Category: Tutorials

NetBeans IDE and Yii projects

Created 13 years ago by marcovtwout, updated 9 years ago by marcovtwout.

This page is created to supply short directions and general tips for managing a Yii application in NetBeans IDE.

65 0
66 followers
Viewed: 248 483 times
Version: 1.1
Category: Tutorials

CJuiDialog to create new model

Created 13 years ago by zaccaria, updated 7 years ago by Maurizio Domba Cerin.

In this tutorial we will learn how to realize a create interface using a dialog.

55 0
64 followers
Viewed: 127 534 times
Version: 1.1
Category: Tutorials

How to work with flash messages

Created 15 years ago by pfth, updated 12 years ago by François Gannaz.

Set your messages in a controller:

Yii::app()->user->setFlash('success', "Data1 saved!");
Yii::app()->user->setFlash('error', "Data2 failed!");
Yii::app()->user->setFlash('notice', "Data3 ignored.");
51 0
40 followers
Viewed: 385 889 times
Version: 1.1
Category: Tutorials

Getting to Understand Hierarchical RBAC Scheme

Created 13 years ago by daemons, updated 9 years ago by rAWTAZ.

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 a...

47 0
56 followers
Viewed: 125 459 times
Version: 1.1
Category: Tutorials

Use shortcut functions to reduce typing

Created 14 years ago by qiang, updated 11 years ago by Yang He.

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...

46 0
45 followers
Viewed: 66 589 times
Version: 1.1
Category: Tutorials
Tags:

Understanding "Assets"

Created 13 years ago by Steve Friedl, updated 12 years ago by GOsha.

Many newcomers to Yii ask about the assets/ directory found under the webroot, and this article means to explain why it's there and how to work with it.

46 0
40 followers
Viewed: 207 681 times
Version: 1.1
Category: Tutorials

Creating a dependent dropdown

Created 15 years ago by dalip, updated 9 years ago by Paul_Kish.

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.

83 2
92 followers
Viewed: 411 806 times
Version: 1.1
Category: Tutorials

Behaviors & events

Created 14 years ago by pestaa, updated 11 years ago by Gismo.

These features provide endless possibilities and unbelievable flexibility, but as current documentation does not give more than a few examples, it might be difficult to fully understand their internals and requirements.

43 0
48 followers
Viewed: 160 155 times
Version: 1.1
Category: Tutorials
Tags:

Update content in AJAX with renderPartial

Created 14 years ago by Burzum, updated 11 years ago by hairylunch.

The easiest way to update content in AJAX is to use the renderPartial method.

43 0
46 followers
Viewed: 351 693 times
Version: 1.1
Category: Tutorials
Tags: AJAX

(draft) Understanding Yii 3

Created 5 years ago by Mehdi Achour, updated a year ago by samdark.

This document is intended for an audience already familiar with Yii2. It's meant to bring together all information related to Yii 3 in one place to make it easier to get on track.

39 0
17 followers
Viewed: 188 878 times
Version: 3.0
Category: Tutorials
Tags: yii3

CSS Naming Conventions

Created 13 years ago by qiang, updated 5 years ago by samdark.

In this article, we introduce a set of CSS naming conventions that we have applied in several big projects and achieved success. The goal of these naming conventions is to eliminate the possibility of naming conflicts, facilitate debugging and maintenance, and to simplify the naming process.

35 0
24 followers
Viewed: 48 316 times
Version: 1.1
Category: Tutorials

SEO-conform Multilingual URLs + Language Selector Widget (i18n)

Created 12 years ago by c@cba, updated 12 years ago by c@cba.

You have a multilingual application, and you want the URL of a page to be different for different languages, to account for SEO. The URL for the contact page for example should look like http://something.com/en/contact in english, and http://something.com/de/contact in german. This tutorial describes how to make it happen.
Note that currently selected language is always a part...

28 0
42 followers
Viewed: 75 764 times
Version: 1.1
Category: Tutorials

XUpload Workflow

Created 11 years ago by Asgaroth, updated 11 years ago by Asgaroth.

This wiki describes a more complex workflow using the XUpload widget

28 0
42 followers
Viewed: 94 993 times
Version: 1.1
Category: Tutorials

Add information to Yii::app()->user by extending CWebUser

Created 14 years ago by atrandafir, updated 11 years ago by Yang He.

This little tutorial explains a way how you can retrieve more parameters from Yii::app()->user by adding a component that extends CWebUser and retrieves the user information from database table named User.

27 0
38 followers
Viewed: 151 115 times
Version: 1.1
Category: Tutorials
Tags:

Creating Yii applications with composer

Created 11 years ago by schmunk, updated 11 years ago by SleepWalker.

When creating web-application projects, you can add a great variety of different extensions, modules, plugins or scripts to your code-base. But maintaining a stable combination and updating certain packages can become a hard task.

27 0
32 followers
Viewed: 114 594 times
Version: 1.1
Category: Tutorials