- LAMP
# 1. create a project from yii:
- cd to the web root and run the follow in the cmd:
# 2. config the project
- go to the ./config/main.php
- remove the comment and add your customed password of the generator
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'[YOURPASSWORD]',
'ipFilters'=>array('127.0.0.1','::1'),
),
- also have an application base directory /wwwroot/project_name/protected. It should be protected from being accessed by Web users. For Apache httpd Web server, we place under this directory a .htaccess file with the following content:
- set up create and write access to the view, model and controller folder
chmod -777 view -R
chmod -777 controller -R
chmod -777 model -R
- The gii tool should be removed when running on the production machine.
- The debug mode should also be disabled on a production machine.
# 3. then edit the view/greeting page
- localhost/[project]/index.php?r=greeting/index
r = route the request takes the controller id / action id pair
greeting = controller id - tells greeting controller class
index = action id - tells to use the action index in the class
- $this in the view file refers to the controller class which renders it
# 4. config database
- Config the database in the config/main.php and uncomment the mysql
- change the database name, password, username for the mysql
- go to gii "Model Class" to create the model of [modelid]
- name the table prefix, name class.
the table prefix fields will ignore the prefix will choosing the model class
# 5. create the ORM using CRUD module
- go to the crud module and type in the [modelid]
- create the crud object
- go to the link: index.php?r=[modelid]
Reference:
1. http://www.yiiframework.com/doc/guide/1.1/en/quickstart.installation
2. http://www.yiiframework.com/screencasts/
deny from all
yii/framework/yiic webapp [project_name]
No comments:
Post a Comment
(Coding && Eating) || Sleeping