Wiki articles in category Tutorials

Showing 241-260 of 264 items.

Using CAutoComplete to display one value and submit another

Created 15 years ago by luoshiben, updated 11 years ago by mohammad sharif ahrari.

Have you ever wanted to use an auto-complete field to look up a user or some other data, but want the database ID of that user or data returned as well so that you can more easily perform some function when the form is submitted? Thanks to Yii's CAutoComplete widget and [jQuery's Autocomplete plugin](http://plugins.jquery.com/project/jq-autocomp...

7 3
11 followers
Viewed: 64 327 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 802 times
Version: 1.1
Category: Tutorials

How to create a breadcrumb widget

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

Here's a simple way to create a breadcrumb widget to be used in your templates. The idea is just to isolate how the breadcrumb is generated based on an array of crumbs.

10 0
11 followers
Viewed: 83 775 times
Version: 1.1
Category: Tutorials
Tags:

How to display static pages in Yii?

Created 15 years ago by qiang, updated 11 years ago by resurtm.

In a Web application, we often need to display pages like "about this site", "legal information", whose content are mostly static. There are several approaches to deal with this kind of pages.

14 0
13 followers
Viewed: 83 574 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 887 times
Version: 1.1
Category: Tutorials

How to generate Web feed for an application

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

Web feed is a data format used for providing users with frequently updated content. In this article, we describe how to use Zend_Feed, an excellent component from Zend Framework to generate Web feed for an Yii application. This article can also serve as a general guide...

3 0
9 followers
Viewed: 37 226 times
Version: 1.1
Category: Tutorials
Tags:

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 865 times
Version: 1.1
Category: Tutorials

How to customize Yii core messages?

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

Yii core messages refer to static text strings in the core Yii framework code which are meant to be displayed to end-users (e.g. core exception messages, default validation error messages). Customization of these core messages is needed in two circumstances:

17 0
16 followers
Viewed: 67 714 times
Version: 1.1
Category: Tutorials

How to make use of a fragment cache

Created 15 years ago by dalip, updated 13 years ago by wei.
1 0
2 followers
Viewed: 17 228 times
Version: 1.1
Category: Tutorials

How to hide index.php on nginx

Created 15 years ago by miles, updated 12 years ago by Darwin Wen.

For a complete sample Nginx+PHP-FPM config, view this how-to: Nginx & PHP-FPM

4 0
12 followers
Viewed: 91 416 times
Version: 1.1
Category: Tutorials
Tags: URL

AutoTimestampBehavior

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

This behavior will automatically set timestamp fields to the row creation and modification times.

2 2
3 followers
Viewed: 22 524 times
Version: 1.1
Category: Tutorials
Tags:

Eclipse PDT - code-hints, references and other goodies

Created 15 years ago by mindeh, updated 13 years ago by Woil.

Since PHP is dynamically typed language, the way IDE may help you is limited.

14 0
6 followers
Viewed: 41 123 times
Version: 1.1
Category: Tutorials
Tags: IDE

How to use Highslide for image popups

Created 15 years ago by mocapapa, updated 13 years ago by wei.

>Highslide JS is an open source JavaScript software, offering a Web 2.0 approach to popup windows. It streamlines the use of thumbnail images and HTML popups on web pages. > > + No plugins like Flash or Java required. > + Popup blockers are no problem. The content expands within the active browser window. > + Single click. After opening the image or HTML popup, the user can scroll further down...

1 0
2 followers
Viewed: 27 750 times
Version: 1.1
Category: Tutorials
Tags: image, popups

How to filter data using a dropdown list?

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

A dropdown list can be used to select a value, based on which we can filter the data to be displayed. For example, the extension page has a dropdown list to filter the displayed extensions according to the selected category.

7 0
6 followers
Viewed: 41 852 times
Version: 1.1
Category: Tutorials
Tags:

How to automate timestamps in ActiveRecord models

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

There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:

26 0
34 followers
Viewed: 178 535 times
Version: 1.1
Category: Tutorials
Tags:

How to log changes of ActiveRecords?

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

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

31 1
47 followers
Viewed: 72 341 times
Version: 1.1
Category: Tutorials
Tags: Logging

Advanced CTabView using CClipWidget

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

Here is a way to dynamically extend tabs based on clips.
Probably even more complex things could be done.

2 0
2 followers
Viewed: 18 181 times
Version: 1.1
Category: Tutorials
Tags:

Q: My yiic tool cannot run model and crud commands. Why?

Created 15 years ago by qiang, updated 15 years ago by mishhh.

Some PHP installations may use a different php.ini file for CLI PHP (command line PHP parser). As a result, when running the model or crud command in yiic shell, you may encounter errors like "YiiBase::include(PDO.php): failed to open stream..." or "...could not find driver", even though the requirement checker confirms you have PDO and the corresponding database driver.

0 0
1 follower
Viewed: 14 934 times
Version: 1.1
Category: Tutorials
Tags:

How to add more information to Yii::app()->user

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

By default, the expression Yii::app()->user returns a [CWebUser] [application component](http://www.yiiframework.com/doc/guide/basics.application#application-component) which represents the information that are closely related with the current user. Some information can be persistent throughout the current user session. For example, [CWebUser] already comes with a [name|CWebUser::name] property th...

21 0
28 followers
Viewed: 226 405 times
Version: 1.1
Category: Tutorials

First Yii App: CTabView

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

Once you are completed with the "Creating First Yii Application", the following can be done.

0 2
1 follower
Viewed: 27 501 times
Version: 1.1
Category: Tutorials
Tags: