I have this function where its first called normally by a link (http
request). Once loaded the pagination links are done via Ajax. I have 'all',
'new', 'archive' links which all get called to paginate the result using
Ajax and jquery. Problem is when i go to posts/index it works fine, click
'all' which loads index it loads the layout too. The other links all work
fine and load the element except "all"
function index() {
if ($this->RequestHandler->isAjax()) {
//code for view
$this->layout = 'ajax';
$this->viewPath = 'elements/posts';
$this->render(paginate');
}
if (!$this->RequestHandler->isAjax()) {
//code for view
$this->layout = 'default_left';
$this->render('index');
}
}
so this here will filter the posts depending on what the user clicked 'all',
'new', 'archive'
But 'all' when clicked always returns the 'default_left' layout
function filterByType($type = null) {
if ($this->RequestHandler->isAjax()) {
$this->paginate['Post'] =
$this->Post->filterByTypePagination($this->auth_id, $this->rank, $type,
$this->post_display);
$this->set('posts', $this->paginate());
$this->layout = 'ajax';
$this->viewPath = 'elements/posts';
$this->render('paginate');
} else {
$this->redirect(array('action' => 'index'));
}
}
Cann someone point out where I am going wrong? I tried
if ($this->RequestHandler->isAjax()) {
//code for view
$this->layout = 'ajax';
$this->viewPath = 'elements/posts';
$this->render(paginate');
} else {
//code for view
$this->layout = 'default_left';
$this->render('index');
}
but same thing keeps happening.
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---