To give you an initial experience with Yii, in this section we describe how to create your first Yii application. We will useyiic (command line tool) to create a new Yii application andGii (powerful web based code generator) to automate code creation for certain tasks. For convenience, we assume thatYiiRoot is the directory where Yii is installed, and WebRootis the document root of our Web server.
Run yiic on the command line as follows:
% YiiRoot/framework/yiic webapp WebRoot/testdrive
Note: When running yiic on Mac OS, Linux or Unix, you may need to change the permission of the yiic file so that it is executable. Alternatively, you may run the tool as follows,
% cd WebRoot % php YiiRoot/framework/yiic.php webapp testdrive
This will create a skeleton Yii application under the directory WebRoot/testdrive. The application has a directory structure that is needed by most Yii applications.
Without writing a single line of code, we can test drive our first Yii application by accessing the following URL in a Web browser:
http://hostname/testdrive/index.php
As we can see, the application has four pages: the homepage, the about page, the contact page and the login page. The contact page displays a contact form that users can fill in to submit their inquiries to the webmaster, and the login page allows users to be authenticated before accessing privileged contents. See the following screenshots for more details.

.
.
.
.
testdrive/
index.php Web application entry script file
index-test.php entry script file for the functional tests
assets/ containing published resource files
css/ containing CSS files
images/ containing image files
themes/ containing application themes
protected/ containing protected application files
yiic yiic command line script for Unix/Linux
yiic.bat yiic command line script for Windows
yiic.php yiic command line PHP script
commands/ containing customized 'yiic' commands
shell/ containing customized 'yiic shell' commands
components/ containing reusable user components
Controller.php the base class for all controller classes
UserIdentity.php the 'UserIdentity' class used for authentication
config/ containing configuration files
console.php the console application configuration
main.php the Web application configuration
test.php the configuration for the functional tests
controllers/ containing controller class files
SiteController.php the default controller class
data/ containing the sample database
schema.mysql.sql the DB schema for the sample MySQL database
schema.sqlite.sql the DB schema for the sample SQLite database
testdrive.db the sample SQLite database file
extensions/ containing third-party extensions
messages/ containing translated messages
models/ containing model class files
LoginForm.php the form model for 'login' action
ContactForm.php the form model for 'contact' action
runtime/ containing temporarily generated files
tests/ containing test scripts
views/ containing controller view and layout files
layouts/ containing layout view files
main.php the base layout shared by all pages
column1.php the layout for pages using a single column
column2.php the layout for pages using two columns
site/ containing view files for the 'site' controller
pages/ containing "static" pages
about.php the view for the "about" page
contact.php the view for 'contact' action
error.php the view for 'error' action (displaying external errors)
index.php the view for 'index' action
login.php the view for 'login' action
testdrive/
index.php 웹 어플리케이션 진입 스크립트 파일
index-test.php 기능 테스트를 위한 스크립트 파일
assets/ 공개된 자원 파일
css/ CSS 파일
images/ 이미지 파일
themes/ 어플리케이션 테마
protected/ 외부 접근이 제한된 어플리케이션 파일
protected/ 외부 접근이 제한된 어플리케이션 파일
yiic yiic 커맨드 라인 스크립트(리눅스/유닉스용)
yiic.bat yiic 커맨드 라인 스크립트(윈도우용)
yiic.php yiic 커맨드 라인 PHP 스크립트
commands/ 커스트마이즈한 'yiic' 명령문 포함
shell/ 커스트마이즈한 'yiic' 쉘 명령문 포함
components/ 재사용 가능한 컴포넌트 포함
Controller.php 컨트롤러 클래스를 위한 기반 클래스
Identity.php 인증을 위한 Identity 클래스
config/ 설정 파일 포함
console.php 콘솔 어플리케이션 설정
main.php 웹 어플리케이션 설정
test.php 기능 테스트를 위한 설정
controllers/ 컨트롤러 클래스 파일 포함
SiteController.php 디폴트 컨트롤러 클래스
data/ 샘플 데이터베이스 포함
schema.mysql.sql 샘플 MySQL 데이터베이스를 위한 DB 스키마
schema.sqlite.sql the 샘플 SQLite 데이터베이스를 위한 DB 스키마
testdrive.db 샘플 SQLite 데이터베이스 파일
extensions/ 써드 파티 확장 포함
messages/ 다국어 메시지 포함
models/ 모델 클래스 포함
LoginForm.php 'login' 액션을 위한 form 모델
ContactForm.php 'contact' 액션을 위한 form 모델
runtime/ 임시로 생성된 파일 포함
tests/ 테스트 스크립트 포함
views/ 뷰와 레이아웃 파일 포함
layouts/ 레이아웃 뷰 파일 포함
main.php 모든 페이지에서 공유하는 기반 레이아웃
column1.php 단일 컬럼을 사용하는 페이지에 대한 레이아웃
column2.php 2 컬럼을 사용하는 페이지에 대한 레이아웃
site/ 'site' 컨트롤러를 위한 뷰 파일 포함
pages/ 정적 페이지 포함
about.php "about" 페이지에 대한 뷰 파일
contact.php 'contact' 액션에 대한 뷰 파일
error.php 'error' 액션에 대한 뷰 파일 (외부 에러 표시)
index.php 'index' 액션에 대한 뷰 파일
login.php 'login' 액션에 대한 뷰 파일

