Saturday, January 28, 2012

PHP - Yii Development

Installing Yii


1. Download the Yii Framework from http://www.yiiframework.com/
download/.
2. Unpack the downloaded file to a web-accessible folder.


To invoke the tool and have it verify the requirements for your installation, simply point
your browser to:
http://yourhostname/path/to/yii/requirements/index.php

The following screenshot shows the results we see for our configuration:



Creating a new application


To create a new application, we are going to use a little powerhouse of a tool known
as yiic that comes packaged with the framework.


For the purpose of this demo application, we will
assume the following:
• YiiRoot is the folder where you have installed Yii
• WebRoot is configured as the document root of your web server
• From your command line, change to your WebRoot folder and execute
the following:
% cd WebRoot
% YiiRoot/framework/yiic webapp demo
Create a Web application under '/Webroot/demo'? [Yes|No]
Yes
mkdir /WebRoot/demo
mkdir /WebRoot/demo/assets
mkdir /WebRoot/demo/css
generate css/bg.gif
generate css/form.css
generate css/main.css
Your application has been created successfully under /Webroot/demo.


Configuring Gii:


Before we can start using Gii, we have to configure it for use within our application.
At this point you probably know enough to guess we would do that in our main
application configuration file, protected/config/main.php. This is correct. To
configure Gii for use, open this file and add the following highlighted code to the
returned array:



return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',


// preloading 'log' component
'preload'=>array('log'),


// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),


'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
//'password'=>'Enter Your Password Here',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),

),







Reference:
http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

No comments:

Post a Comment