Returning To Page With Pagination


I am trying to redirect the update page to the admin management page with the correct pagination URL.

So the work flow is like this.

  1. index.php/image/admin?Image_page=9

  2. Click on a record to update


  3. On save, redirect back to


I have got the logic working of redirecting back to a Image_page number, but I am using the image id to determine the page number.

So like ceil(PICTURE ID/10), since the pagination is set up to have ten images per page and at the moment, the divide by ten assumption holds, but as images are deleted it doesn’t.

So my question, how can I get Image_page number on the update page?

I had some success using


but for some reason the Image_page=9 is not set when I try use it.

Is there are better way (not to mention how handy it would be in general), to pass variables / get / post data between pages?


Dear Friend

I hope the following is helpful.

Model Box

public function actionUpdate($id)



		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);





			       { $arr=array();


			        foreach($boxes as $box) 



			        $page=ceil(($pos+1)/10);//10 indicates pagesize








It is assumed that you have not employed any default sorting in search method of model.

Thank you for the prompt reply, I will give this a try in the morning when I get to work. Very much appreciated :)


This code worked great!

It feels like it should be done by actually passing the Image_page get number instead of having to divide by ten though. Or is this the preferred way of doing it?

Again thank you very much :)


I do like your method because it works even if you update an image via some other method. It redirects to where that image is on the right pagination page.

Kudos to you!