I'm using the Pagination helper in 1.2, and I have it working using
AJAX, but I'm not sure I'm using it correctly.
This is my scenario:
I have a view named users with an index page that displays a paginated
view of all users.
The index method in my users controller originally contained this
code:
$this->User->recursive = 0;
$this->set('users', $this->paginate());
and my index.ctp file uses the paginator to display the list of users.
My default.ctp layout is a typical layout page with a section in the
middle that looks like this:
<div id="content">
<?php echo $content_for_layout; ?>
</div>
With this setup, whenever I use the paginator to view other pages, the
entire index.ctp is displayed inside the default.ctp layout within the
content section.
The only way I was able to get around this was to change my index
method in the users controller to this:
$this->User->recursive = 0;
if ($this->action == "index" && isset($this->params['named']['page']))
$this->layout = "";
$this->set('users', $this->paginate());
Forcing it to not use the default.ctp layout if the ajax "page"
parameter was passed in.
It seems like the paginator should know not to use the overall page
layout, as I am just try to render the content section.
I would be interesting in hearing any other ideas on how to make this
work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---