Yii's ActiveRecord classes are powerful, but they fall short when you want to have a configurable table prefix for your application.
Yii's ActiveRecord classes are powerful, but they fall short when you want to have a configurable table prefix for your application.
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.
Adding HTTP compression to your application could never have been easier!
When you need to integrate with other frameworks (e.g. Zend Framework), you have to follow these steps:
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.
Here is a quick tutorial for connecting Yii with Twitter using the Pogostick Yii Extensions Library.
Logging context information (session, user, ...) to the logfile can be of great help tracking down problems with specific users.
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...
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...
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...
Since Yii 1.0.5 you can use named scopes with ActiveRecords. They are a great help in simplifying your query calls.
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.
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:
The Yii documentation states:
As seen in this post, Yii doesn't enforce how language is set and maintained within the session.
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...
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.
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.
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.
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.");