Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:25:20+00:00 2026-06-17T11:25:20+00:00

I have an action called index and another one called manage , both in

  • 0

I have an action called index and another one called manage, both in PostsController. I want to implement pagination for both, and I’ve set up this class attribute:

public $paginate = array(
    'limit' => 10,
    'order' => array(
        'Post.created' => 'desc'
    )
);

then I’m using the pagination in my index action like so: $this->set('posts', $this->paginate('Post'));

This results in a URL like so: http://dev/posts/page:2 which is fine.

However, when I try to use pagination in my manage action just like I did with index ($this->set('posts', $this->paginate('Post'));), the pagination links on my view redirect to the URL above, rather than the manage action.

Basically, Cake is getting confused because I’m using pagination twice in the same controller and it’s redirecting both to the same URL. How can I make sure that the pagination for the manage action works properly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:25:20+00:00Added an answer on June 17, 2026 at 11:25 am

    Do the followings.

    <?php
    class PostsController extends AppController
    {
        var $name = 'Posts';
        public $paginate = array
        (
            'limit' => 10,
            'order' => array
            (
                'Post.created' => 'desc'
            )
        );
    
        function index()
        {
            $this->Post->recursive = 0;
            $this->set('posts', $this->paginate('Post'));
        }
    
        function manage()
        {
            $this->Post->recursive = 0;
            $this->set('posts', $this->paginate('Post'));
        }
    }

    make changes in view file as defined below.

    index.ctp

    $options = array
    (
        'url'=> array
        (
            'controller' => 'posts', 
            'action' => 'index'
         )
    );
    $paginator->options($options);

    manage.ctp

    $options = array
    (
        'url'=> array
        (
            'controller' => 'posts', 
            'action' => 'manage'
         )
    );
    $paginator->options($options);

    And you are done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that I want to be executed before every action is called.
I have a class that has an Action<string> called DisplayData ; In various points
Actually im doing a home page that only have an action called Index() that
I have a controller named BearController. In it I have one index action method
I have a rails action called index that renders the content for my page
I have an action called 'watched' defined on an object 'Movie' (using the inbuilt
I have a controller called Diary with an action called View . If I
Projects have many tasks and a task has a custom RESTful action called 'approve'.
I have an ASP.NET MVC 3 application which has a post action called Create
I have an action method VerifyNewUser() that gets called when the user clicks a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.