Using Csort With Cactivedataprovider

First of all, thank you for this forum and for all your “free” support. I’m a Yii newbie, so please be gentle with me! :slight_smile:

I’m trying to use CSort within an actionIndex that use CActiveDataProvider, the same activeIndex() of the “Blog” Demo. I’m trying to display a custom “title” sort link within the index.php, and it’s done. I succeed to make it works creating 2 new CSort objects, and I’m sure this is not the right procedure.

This is the actionIndex():

public function actionIndex()


		$criteria=new CDbCriteria(








                //Piece of code to create CSort instance...

                if (isset($_GET['sort'])) {

                    $sort = new CSort('Post');






		$dataProvider= new CActiveDataProvider('Post', array(










and these are the rows within the index.php:


$order = new CSort('Post');

echo $order->link('title', 'Title');


Now, is it possible to make it works better, just creating one CSort instance? I tried to pass the $sort variable to index.php but i can’t succeed.

Thank you!

Hoops…guys, no way to help me?! :slight_smile: