create mvc structure with existing database in yii using gii tool


I am totally beginners to yii framework and sharing my yii code and methods that worked for me.So yii is very easy and flexible to learn and write web application.

To start gii tool set the password for the gii in the file location

opt/lampp/htdocs/project_name/protected/config/main.php

'modules'=>array(
        // uncomment the following to enable the Gii tool

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

    ),

The gii as already testdriver.db which as default login table configured in main.php file located in

'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),

To connect gii generator to existing database the following code should be uncomment the code in the file main.php.

opt/lampp/htdocs/project_name/protected/config/main.php

        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=mydb',
            'emulatePrepare' => true,
            'username' => '',
            'password' => '',
            'charset' => 'utf8',
        ),

To acces the gii page in browser

http://localhost/project_name/index.php?r=gii


Advertisements
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , , , , , , ,
Posted in php, yii framework

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow php tutorial on WordPress.com
categories
Calendar
February 2014
M T W T F S S
« Jan   Mar »
 12
3456789
10111213141516
17181920212223
2425262728  
Follow me on Twitter
Blog Stats
  • 73,826 hits
%d bloggers like this: