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.
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.
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.
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.
The easiest way to update content in AJAX is to use the renderPartial method.
Original source code and idea are from: PHP, PDO & Nested Transactions.
Something a good application cant miss is documentation, and what would be better than some nice formatted HTML documentation that can be auto-generated from your code, we know several tools that already do this like phpDocumentor, but today we are introducing Yii Docs Generator...
Ctrl+Space
.Ctrl+Q
.Even though it looks complicated at the beginning, you will find that it is not that hard as it seems once you understand its structure. Yii's project structure wiki obviously inspired a lot of this setup, and you will find that some of the paragraphs here are taken from their wiki.
If we take a look at the blog demo we have 3 major parts of our view rendering. They are:
The two most commonly-used base classes in most Yii applications are CController
and CActiveRecord
, each extended to your own particular models and controllers.
I have had to do this a couple of times now so I figured I would share it with the community. I am going to keep this short because I really hope that you are familiar with jQueryUI's Sortable class before starting this tutorial.
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.
Relational databases do not support inheritance so if we need to represent it, we have to somehow store meta info while keeping performance by minimizing JOINs. One way to solve this problem is using single table inheritance. All fields for the whole class tree are stored in a single table. Class name is stored in the type field...
Gii provides us normally with the following code on the 'actionCreate':
public function actionCreate()
{
$model=new ModelName;
This is a list of blogs, off-site tutorials and other resources about Yii.
Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.
Normally when we want users to download a file, that file is put in a folder under the web application root and the web server does the rest.
This had me stumped for a while so I figured it would be nice to share here to avoid others the grief.
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...