-
Book Overview & Buying
-
Table Of Contents
Yii Application Development Cookbook - Second Edition - Second Edition
Zii lists is a good tool to display data from any data provider to end users while handling pagination and sorting automatically. CListView is very customizable so it allows the building of any type of list page.
Let's use Gii to generate a list, see how it works, and how we can customize it.
Create a new application using yiic webapp as described in the official guide.
Download the Sakila database from http://dev.mysql.com/doc/index-other.html. Execute the downloaded SQLs (first schema then data).
Configure the database connection in protected/config/main.php.
Use Gii to create models for customer, store, address, and city tables.
Open Gii, select Crud Generator, and enter Customer into the Model Class field. Press Preview and then Generate.
Gii will generate a controller in protected/controllers/CustomerController.php and a group of views under protected/views/customer/.
Run the index action of customer controller to see the customer list in action.

Change the font size
Change margin width
Change background colour