Note that there are some explanatory texts on larger screens.

plurals
  1. POPagination through ajax and showing post on the same page
    primarykey
    data
    text
    <p>I am new to Cakephp, and I m stuck with this thing. my code is working properly but now i need some modification in my code. when I try to paginate my view through different pages it works but as each page fetch 20 posts only, to see the next posts i change the page. Now the 1st 20 post is in my view and on the click of a button using ajax i want to show the next 20 post on the same page (I don't want to redirct to pages to see all the comment) plz help...</p> <p>this is the action that i call to show the view of different pages.</p> <pre><code> public function view($slug) { $topic = $this-&gt;Topic-&gt;getBySlug($slug); $user_id = $this-&gt;Auth-&gt;user('id'); $post_count = $topic['Topic']['post_count']; $this-&gt;paginate['Post']['conditions'] = array('Post.topic_id' =&gt; $topic['Topic']['id']); if ($this-&gt;RequestHandler-&gt;isRss()) { $this-&gt;set('posts', $this-&gt;paginate('Post')); $this-&gt;set('topic', $topic); return; } if (!empty($this-&gt;request-&gt;data['Poll']['option'])) { $this-&gt;Topic-&gt;Poll-&gt;vote($topic['Poll']['id'], $this-&gt;request-&gt;data['Poll']['option'], $user_id); $this-&gt;Topic-&gt;deleteCache(array('Topic::getBySlug', $slug)); $this-&gt;redirect(array('plugin' =&gt; 'forum', 'controller' =&gt; 'topics', 'action' =&gt; 'view', $slug)); } $this-&gt;ForumToolbar-&gt;markAsRead($topic['Topic']['id']); $this-&gt;Topic-&gt;increaseViews($topic['Topic']['id']); $this-&gt;ForumToolbar-&gt;pageTitle($topic['Topic']['title']); $this-&gt;set('topic', $topic); $this-&gt;set('posts', $this-&gt;paginate('Post')); $this-&gt;render('view_new'); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload