Hu Gb

Yii 1.1 Application Development Cookbook

2011.10.10
Packt published the Yii 1.1 Application Development Cookbook from Alexander Makarow, a Yii core developer. It contains 80 recipe about the usage of the framework.
I think the book is for developers whose already know the framework a bit and they want to learn more about it. In the first chapter you can read about the not too familiar but useful features of Yii, like the usage of the "getters" and "setters" in the framework. The following chapters covers pretty much everything you need to know:
  • Router, controller and view
  • AJAX and jQuery
  • Forms
  • Testing
  • Database, and the model layer
  • Components, Zii
  • Extending Yii
  • Error handling
  • Security
  • Performance
  • 3rd party librarys with the framework
  • Deployment

I really liked the book and I recommend to read it to everyone who wants to use Yii for web development.
Továbbolvas

Yii framework DataProvider default order

2011.09.08
The widgets of the Yii framework are using a so called 'dataprovider'. They support the order of the data by any attribute but in some cases we need a default order. To achive this we need to set the 'defaultOrder' property of the 'sort' property(which is a CSort class) of the dataProvider:
$dataProvider=new CActiveDataProvider('Post', array(
	    'criteria'=>array(
	        'condition'=>'status=1',
	        'with'=>array('author'),
	    ),
		'sort' => array(
			'defaultOrder' => 'create_time DESC'
		),
	    'pagination'=>array(
	        'pageSize'=>20,
	    ),
	));
Továbbolvas