views:

34

answers:

2

Please see below code snippt:

<?php
  //Sets the update and indicator elements by DOM ID
  $paginator->options(array('update' => 'content','indicator' => 'spinner','url' =>$this->passedArgs));

  echo $paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
  echo $paginator->next('Next >>', null, null, array('class' => 'disabled'));
?>

And my page url is http://total.projectsjunction.com/artists/portfolios/1

Now I have a problem.I am using AJAX based paging with cakePHP But when i click on next page it calling header and footer two times.

How I can call layout only one time if I use function two time with ajax.

kindly give your support.

Thanks

A: 

Something like this may help you:

if( $this->RequestHandler->isAjax() ) {
  $this->layout = false;
}

This will turn off the layout on an ajax request but leave it on otherwise. I believe this will be specific to a given request, but I haven't tested it and have never needed to do this myself.

Rob Wilkerson
A: 

This may help you get your situation squared away. It applies to CakePHP 1.2, but is hopefully a good starting point.

http://bakery.cakephp.org/articles/view/easy-ajax-pagination-using-jquery

Gabriel