Step 1: Install the framework.
From the www.yiiframework.com site, follow the instructions for pre-requisite to install the Yii framework. Typically you will need
- Apache web browser
- PHP 5.1 and newer
- PHP PDO
- A database
Download Yii-1.1...tar.gz (in tar.gz format) from http://www.yiiframework.com/download/
Extract the tar.gz file to the web folder /var/www/html/yii1
It is also a good point to download the Yii-docs-1.1...tar.gz and extract it to follow its references and tutorials in PDF.
Step 2: Create the skeleton of a new web app.
At the prompt, access the framework's directory /var/www/html/yii1/framework
Type the following:
./yiic webapp ../testdrive
or in windows
yiic webapp ..\testdrive
Open a web browser and access the testdrive application
http://localhost/yii1/testdrive
Step 3: Configure the timezone for the web app.
If an error on the timezone appears, complete following steps
vi /var/www/html/yii1/testdrive/protected/config/main.php
Just before the last line, add the timezone.
'timeZone'=>'Asia/Kuala_Lumpur',
);
Access the testdrive application with the web browser, the error on timezone is gone. It does inform users the following;
You may change the content of this page by modifying the following two files:
View file: C:\Program Files\www\yii1\testdrive\protected\views\site\index.php
Layout file: C:\Program Files\www\yii1\testdrive\protected\views\layouts\main.php
Step 4. Understanding the structure
It is good to know the directories built for the testdrive web application under /var/www/html/yii1/testdrive. From here on, I will refer to the directory /var/www/html/yii1/testdrive as
Step 5. The database, mysql
Create a database named yii_testdrive, and load in the SQL from
By default it has the SQLLITE as its database, edit the file
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
Uncomment the mysql lines below it and edit the database connection
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yii_testdrive',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),
Step 6. Generating the pages based on the database
Uncomment the GII web-based code generator and change the default password to MyPassword
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'MyPassword',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
Open a web browser and point to the gii resource
http://localhost/yii1/testdrive/index.php?r=gii
A login page appears, type the password as
MyPassword
You are then presented with the following to auto generate codes based on your database.
- Controller Generator
- Crud Generator
- Form Generator
- Model Generator
- Module Generator
Thats all for now...will continue when time permits.
2 comments:
Thanks for sharing information about yii framework. if you want to know more about it please view this
Yii framework Features and benefits
Very nice blog… I always enjoy to read your blog tech post… Very good writing skill.. I appreciated what you have done here… Good job! Keep posting.
If you like to learn about Yii 2.0 beta version, please visit this video: www.youtube.com/watch?v=WwT6ar8nQGk
Post a Comment