CListView w/ search

Hello all,

I hope this is a very easy question.

I’m trying to search an item and display it (w/ pagination) using CListView.

This is what I have working.


<?php $this->widget('zii.widgets.CListView', array(


	'id' => '#qwerty',

	'pager' => array(








)); ?>



		         $criteria->addCondition("nombre like '%".$_POST['buscar_amigo']."%' or apellido like '%".$_POST['buscar_amigo']."%'");


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













This works fine, but as when I press the “>” to see the next page of results the $_POST[‘buscar_amigo’] is lost.

Thus instead of showing 50 pages (search result) it resets to 150 pages (all database).

How can I keep this variable alive throughout the pagination?


Answer: Extend CPagination and override its createPageUrl function

Thanks Mr. Cobos ;)

To see full answer: