HARNESS THE POWER OF MVC USING YII FRAMEWORK

HARNESS THE POWER OF MVC USING YII FRAMEWORK

Yii is a high-performance PHP framework best for developing Web 2.0 applications. Yii comes with rich features: MVC, DAO/Active Record, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly. If you would like to develop something in Yii please contact Kreara marketing team

Step 0. Preparation

After downloading and installing the Yii framework, run a simple console command to generate a skeleton Web application built with Yii. The application is fully functional, with nice features including user login and contact form. It is a good starting point for implementing more sophisticated features.

Step 1. You Create the Database

While Yii can virtually eliminate most repetitive coding tasks, you are responsible for the real creative work. This often starts with designing the whole system to be built, in terms of some database schema.

Step 2a. Yii Generates the Model Classes

Now it is Yii’s turn to transform your database schema into functional PHP code. Using the built-in Web-based code generator, you can turn database table definitions into model classes instantly, without writing a single line of code. The model classes will allow you to access the database tables in an object-oriented fashion.

Step 2b. Yii Generates the CRUD Code

Using the aforementioned code generator, you can further generate code that implements the typical CRUD (create, read, update, delete) features for the selected database tables. The generated code is highly usable and customizable, following the well-adopted MVC (model-view-controller) design pattern. Again, Yii does all the dirty work without requiring you to write a single line of code.

Step 3. You customize the code to fit your exact needs

Finally you need to customize the code to fit your exact needs. For example, to hide the password column on the user administration page, simply cross out the ‘password’ element shown in the following user admin view file:

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(

‘id’=>’user-grid’,

‘dataProvider’=>$model->search(),

‘filter’=>$model,

‘columns’=>array(

‘id’, ‘username’,

‘password’,

’email’, array(‘class’=>’CButtonColumn’),

))); ?>

Post A Comment

Protected by WP Anti Spam