Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

download Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

of 21

Transcript of Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    1/21

    Yii FRAMEWORK INSTALLATION

    &

    CREATE WEB APPLICATION

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    2/21

    Download Yii Framework from

    http://www.yiiframework.com/download/andUnpack the Yii release file to a Web-accessible

    directory(C:wampwww in this e!ample" and

    then rename yii.

    #pen yo$r web browser and open

    http://%&'...%/yii/re)$irements/and make s$re

    there is no tro$ble with the re)$irements.

    http://www.yiiframework.com/download/http://127.0.0.1/yii/requirements/http://127.0.0.1/yii/requirements/http://www.yiiframework.com/download/
  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    3/21

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    4/21

    *ow open yo$r command prompt. Chan+e the

    directory to yo$r Yii framework folder $sin+,cd command (cd C:wampwww".

    o b$ild a new webapp nai+ate to the pro0ectroot directory type ,yiiframeworkyiic webapp

    testapp. Finally type ,yes for confirmation.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    5/21

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    6/21

    *ow yo$ can open the web application from

    web browser http://%&'...%/testapp/.

    http://127.0.0.1/testapp/http://127.0.0.1/testapp/
  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    7/21

    #pen $p protectedconfi+main.php andUncomment the lines pertainn+ to the +ii

    mod$le:1+ii123array(

    1class1231system.+ii.4ii5od$le16

    1password1231password16

    // 7f remoed6 4ii defa$lts to localhost only. 8dit caref$lly to taste.

    1ipFilters123array(1%&'...%161::%1"6

    "6

    *ow yo$ can open the web application fromweb browser:http://%&'...%/testapp/inde!.php9r2+ii

    http://127.0.0.1/testapp/index.php?r=giihttp://127.0.0.1/testapp/index.php?r=gii
  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    8/21

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    9/21

    hen yo$ hae enter the password: password foropen the Yii Code 4enerator.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    10/21

    Yii code 4enerators

    Controller 4enerator: his +enerator helps yo$ to )$ickly

    +enerate a new controller class6 one or seeral controlleractions and their correspondin+ iews.

    Cr$d 4enerator: his +enerator +enerates a controller and

    iews that implement CUD operations for the specified

    data model.

    Form 4enerator: his +enerator +enerates a iew script file

    that displays a form to collect inp$t for the specified

    model class.

    5odel 4enerator: his +enerator +enerates a model class

    for the specified database table.

    5od$le 4enerator: his +enerator helps yo$ to +enerate

    the skeleton code needed by a Yii mod$le.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    11/21

    Confi+$re o$r application to $se a database.

    Create a new database6 called Db;User and

    Create a new table in the database called

    tbl;User.

    4o to php5y

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    12/21

    he followin+ fi+$re shows yo$r =>=5y

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    13/21

    *ow to create a new table enter yo$r tablename

    and the n$mber of fields in the table6 then click

    the 14o1 ?$tton.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    14/21

    he ne!t step is to create the fields6 0$st enteral$es for each field name6 type6 len+th of the

    field6 n$ll option and mention whether it is aprimary key or not. hen click the 1@ae1 b$ttonto complete yo$r table creation.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    15/21

    #pen $p testappprotectedconfi+main.php andadd 1db1 application component.

    C mment the f ll win+ t $se a 5y@AB database1db123array(

    1connection@trin+1 23 1s)lite:1.dirname(;;F7B8;;".1/../data/testdrie.db16

    "6

    Unc mment the f ll win+ t $se a 5y@AB database and Chan+ethe db name1db123array(

    1connection@trin+1 23 1mys)l:host2localhostdbname2Db;User16

    1em$late=repare1 23 tr$e6

    1$sername1 23 1root16

    1password1 23 116

    1charset1 23 1$tf16

    "6

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    16/21

    4eneratin+ the User 5odel:

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    17/21

    4eneratin+ CUD Code:

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    18/21

    *ow yo$ can open the web application fromweb browser:

    http://%&'...%/testapp/inde!.php9r2$ser

    We lo+in as an administrator $sin+admin/admin6 we can iew the $ser admin pa+e

    http://127.0.0.1/testapp/index.php?r=userhttp://127.0.0.1/testapp/index.php?r=user
  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    19/21

    We can click on the buttons on each row of data toview, update or delete the corresponding row ofdata.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    20/21

    We can click on the b$ttons on each row of datato iew6 $pdate or delete the correspondin+ rowof data.

  • 8/21/2019 Yii FRAMEWORK INSTALLATION & CREATE WEB APPLICATION

    21/21