Wiki articles

Showing 621-640 of 651 items.

Use shortcut functions to reduce typing

Created 15 years ago by qiang, updated 12 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: 67 838 times
Version: 1.1
Category: Tutorials
Tags:

How to add a named scope to ActiveRecords with a behavior

Created 15 years ago by Mike, updated 12 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: 35 786 times
Version: 1.1
Category: Tutorials
Tags:

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

Created 15 years ago by qiang, updated 12 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: 52 212 times
Version: 1.1
Category: Tutorials
Tags:

How to implement multiple page layouts in an application

Created 15 years ago by qiang, updated 14 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: 126 425 times
Version: 1.1
Category: Tutorials
Tags: layout

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

Created 15 years ago by OriginalCopy, updated 11 years ago by Roman Solomatin.

The Yii documentation states:

3 1
7 followers
Viewed: 60 636 times
Version: 1.1
Category: Tutorials
Tags: module

Setting and maintaining the language in Application (i18n)

Created 15 years ago by olafure, updated 12 years ago by Yang He.

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

19 0
29 followers
Viewed: 163 670 times
Version: 1.1
Category: Tutorials

Using CAutoComplete to display one value and submit another

Created 15 years ago by luoshiben, updated 12 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: 65 420 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: 416 547 times
Version: 1.1
Category: Tutorials

How to create a breadcrumb widget

Created 15 years ago by knut, updated 12 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: 84 678 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: 85 015 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: 389 751 times
Version: 1.1
Category: Tutorials

How to generate Web feed for an application

Created 15 years ago by qiang, updated 12 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: 38 161 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 12 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: 353 555 times
Version: 1.1
Category: Tutorials

How to customize Yii core messages?

Created 15 years ago by qiang, updated 12 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: 68 821 times
Version: 1.1
Category: Tutorials

How to make use of a fragment cache

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

How to set up Unicode

Created 15 years ago by Mike, updated 11 years ago by Roman Solomatin.

To fix issues with display of special language characters once and for all there's a solution: use Unicode UTF-8 everywhere. If everything is set up to use Unicode, you can use mostly every language in your application.

19 0
14 followers
Viewed: 138 019 times
Version: 1.1
Category: How-tos
Tags: i18n, unicode

How to hide index.php on nginx

Created 15 years ago by miles, updated 13 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: 94 973 times
Version: 1.1
Category: Tutorials
Tags: URL

AutoTimestampBehavior

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

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

2 2
3 followers
Viewed: 23 310 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 975 times
Version: 1.1
Category: Tutorials
Tags: IDE

How to use Highslide for image popups

Created 15 years ago by mocapapa, updated 14 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: 28 530 times
Version: 1.1
Category: Tutorials
Tags: image, popups