Wiki

Sorted by viewsX
Displaying 111-120 of 703 result(s).

SEO-conform Multilingual URLs + Language Selector Widget (i18n)

Created 2 years ago by c@cbaTutorials35 comments – viewed 41,132 times – ( +29 ) – version 1.1
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 of the URL, and thus available to the application through $_GET. You don't have to use sessions variables to keep track of the language if you don't want to.

X-Sendfile - serve large static files efficiently from web applications

Created 3 years ago by Maurizio Domba CerinHow-tos5 comments – viewed 40,688 times – ( +26 ) – version 1.1
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.

Creating a database-driven hierarchical Structure combined with CMenu and superfish

Created 4 years ago by thyseusTutorials9 comments – viewed 40,416 times – ( +15 ) – version 1.1
Note: Please also take a look at the newer EMenu extension. This works even better that the deprecated CDropDownMenu!
tags: menu

Use shortcut functions to reduce typing

Created 5 years ago by qiangTutorials8 comments – viewed 40,355 times – ( +56 ) – version 1.1
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 the problem of these lengthy typings, it is worthwhile to define global shortcut functions to some commonly used method calls. They will make the application code look cleaner.

How to hide index.php on nginx

Created 5 years ago by milesTutorials3 comments – viewed 39,972 times – ( +4 ) – version 1.1
For a complete sample Nginx+PHP-FPM config, view this how-to: Nginx & PHP-FPM
tags: URL

How to use single form to collect data for two or more models (CActiveForm and Ajax Validation edition)

Created 3 years ago by RusAlexHow-tos9 comments – viewed 39,674 times – ( +22 ) – version 1.1
With Yii you can use one CActiveForm for collecting data for two or more models with ajax validation and client validation.

CGridView: Use special variable $data in the htmlOptions of a column (i.e. evaluate htmlOptions attribute)

Created 2 years ago by c@cbaTutorials3 comments – viewed 39,347 times – ( +28 / -1 ) – version 1.1
    For each column of the CGridView, we can specify name, value, htmlOptions, cssClassExpression etc. In the declarations of the attributes value and cssClassExpression we can use the "special" variable $data, for example like this: 'value'=>'$data->author->username',.     Now we might want to use $data in the declaration of the htmlOptions attribute, which is normally not possible, to generate for example the tag <td id="3" class="name_3">, where 3 is the id of the data model for the current row, i.e. $data->id. That is, we want to be able to use: 'htmlOptions'=>array('id'=>'$data->id', 'class'=>'"name_{$data->id}"')     Here's a way to accomplish this...

Moving project code outside of webroot (plus multiple project support)

Created 3 years ago by Steve FriedlHow-tos8 comments – viewed 39,317 times – ( +22 / -1 ) – version 1.1
Yii's by-default directory organization works well enough, but there are several steps one can take that improve the security and serviceability of the system, especially in the context of multiple Yii projects on the same machine (including multiple versions of the same project).
tags: config, security

How to write a simple application component

Created 3 years ago by zaccariaHow-tos5 comments – viewed 39,224 times – ( +19 / -7 ) – version 1.1
An application component is a confortable way for share information among all component of the application

Beginner / Intro Tutorials (please add to / update this list)

Created 5 years ago by Ivo RoperTutorials1 comment – viewed 38,793 times – ( +5 ) – version 1.1
This is a central location to collect links to "Getting Started" documentation beyond the blog demo and Creating First Yii Application. Please help the community by adding general, introductory links and descriptions to this page.