Wiki articles

Showing 21-40 of 650 items.

How to work with flash messages

Created 10 years ago by pfth, updated 7 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.");
50 0
41 followers
Viewed: 326 998 times
Version: 1.1
Category: Tutorials

How to display static pages in Yii?

Created 10 years ago by qiang, updated 6 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: 70 147 times
Version: 1.1
Category: Tutorials

How to create a breadcrumb widget

Created 10 years ago by knut, updated 7 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: 77 106 times
Version: 1.1
Category: Tutorials
Tags:

Creating a dependent dropdown

Created 10 years ago by dalip, updated 4 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: 355 770 times
Version: 1.1
Category: Tutorials

Using CAutoComplete to display one value and submit another

Created 10 years ago by luoshiben, updated 6 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: 56 276 times
Version: 1.1
Category: Tutorials

Setting and maintaining the language in Application (i18n)

Created 10 years ago by olafure, updated 7 years ago by Yang He.

As seen in this post, Yii doesn't enforce how language is set and maintained within the session.

18 0
29 followers
Viewed: 112 645 times
Version: 1.1
Category: Tutorials

How to access a component of a module from within the module itself

Created 10 years ago by OriginalCopy, updated 6 years ago by Roman Solomatin.

The Yii documentation states:

3 1
7 followers
Viewed: 49 092 times
Version: 1.1
Category: Tutorials
Tags: module

How to implement multiple page layouts in an application

Created 10 years ago by qiang, updated 8 years ago by wei.

In this tutorial, we describe how to implement multiple layouts for action views in an application. As an example, we assume that the pages in our application will use three different layouts:

19 0
22 followers
Viewed: 113 890 times
Version: 1.1
Category: Tutorials
Tags: layout

How to create/save more Model inputs and make them repeatable with jQuery

Created 10 years ago by qiang, updated 7 years ago by Yang He.

This is the first real problem that I encountered using Yii, trying to make a Model input repeatable in the form, validate and save them.

11 0
16 followers
Viewed: 43 744 times
Version: 1.1
Category: Tutorials
Tags:

How to add a named scope to ActiveRecords with a behavior

Created 10 years ago by Mike, updated 7 years ago by yiqing95.

Since Yii 1.0.5 you can use named scopes with ActiveRecords. They are a great help in simplifying your query calls.

2 0
10 followers
Viewed: 27 201 times
Version: 1.1
Category: Tutorials
Tags:

Use shortcut functions to reduce typing

Created 10 years ago by qiang, updated 7 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: 55 137 times
Version: 1.1
Category: Tutorials
Tags:

Manage application configuration in different modes

Created 10 years ago by qiang, updated 7 years ago by 张 迪.

Application configuration determines how an Yii application should behave, because it is the only parameter passed in the entry script. An application, on the other hand, needs to behave differently under different circumstances. For example, an application may need different configurations when running in production mode, development mode and testing mode; In a team development environment, each...

15 0
15 followers
Viewed: 43 507 times
Version: 1.1
Category: Tutorials

Organize directories for applications with front-end and back-end

Created 10 years ago by qiang, updated a year ago by CeBe.

Large applications are often divided into front-end and back-end (or even more ends) depending on the target user groups. The front-end should be used by common users, while the back-end mainly the administrators or staff members. The two ends usually have dramatically different appearance, even though they may share a lot of code underneath. In this tutorial, we describe a way of organizing direc...

25 0
34 followers
Viewed: 83 871 times
Version: 1.1
Category: Tutorials
Tags:

How to log context information to logger (session id, user, ...)

Created 10 years ago by olafure, updated 7 years ago by ajsharma.

Logging context information (session, user, ...) to the logfile can be of great help tracking down problems with specific users.

2 0
5 followers
Viewed: 18 703 times
Version: 1.1
Category: Tutorials
Tags: Logging

How To Connect With Twitter From Yii

Created 10 years ago by lucifurious, updated 8 years ago by wei.

Here is a quick tutorial for connecting Yii with Twitter using the Pogostick Yii Extensions Library.

4 1
12 followers
Viewed: 28 021 times
Version: 1.1
Category: Tutorials
Tags: twitter

How to use markItUp! on a text field for full WYSIWYG editing

Created 10 years ago by lucifurious, updated 8 years ago by wei.

This tutorial will show you how to use the Pogostick Yii Extension Library to make an HTML TEXTAREA input element into a full-fledged WYSIWYG editor pretty much with very little code.

3 0
3 followers
Viewed: 29 582 times
Version: 1.1
Category: Tutorials

Integrating with other frameworks

Created 10 years ago by KJedi, updated 10 years ago by KJedi.

When you need to integrate with other frameworks (e.g. Zend Framework), you have to follow these steps:

4 1
7 followers
Viewed: 24 185 times
Version: 1.1
Category: Tutorials
Tags:

How to use nested DB transactions (MySQL 5+, PostgreSQL)

Created 10 years ago by mindeh, updated 3 years ago by Boaz.

Original source code and idea are from: PHP, PDO & Nested Transactions.

41 0
26 followers
Viewed: 50 157 times
Version: 1.1
Category: How-tos

Enabling Gzip

Created 10 years ago by pestaa, updated 7 years ago by Yang He.

Adding HTTP compression to your application could never have been easier!

6 1
13 followers
Viewed: 29 443 times
Version: 1.1
Category: Tutorials
Tags:

How to extend yiic shell commands

Created 9 years ago by qiang, updated 8 years ago by wei.

While yiic shell tool is very convenient at generating skeleton code in our application, the generated code is not always what we want. For example, we may want the generated code to carry specific copyright information; we may want to use our own coding style; we may want to add more features; and so on. All these can be accomplished easily in Yii.

2 0
5 followers
Viewed: 27 703 times
Version: 1.1
Category: Tutorials
Tags: yiic