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 7815451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:31:37+00:00 2026-06-02T05:31:37+00:00

I have an action from a controller that provides a result variable via $this->set(‘found_products’,

  • 0

I have an action from a controller that provides a result variable via $this->set('found_products', $data);. The view page products.ctp is divided into two sections:

  1. On top, a form where a user enters a string to search $found_products is set for the view.

  2. Below it, paginated results that is displayed only if $found_products is set. i.e. if (isset($found_products)) is true.

When if (isset($found_products)) is true, I get the first page displayed below the form with the search string already in the text box. The URL for this is myapp/controller/products.

The problem occurs when I move into the next pages. The URL becomes myapp/controller/action/products:2 and none of the variables used under myapp/controller/products exist. It looks like moving onto a new page clears all variables.. Below is the code I’m using for paging, and I have no reroute rules written for this. How do I solve this issue?

        <div class="paging">
            <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
            <?php echo $this->Paginator->numbers();?>        
            <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
        </div>

I’ve tried to work around this using $_SESSION in the action (products) and setting this for the view, but when I did this, `$this->Paginator’ no longer worked.

  • 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-02T05:31:40+00:00Added an answer on June 2, 2026 at 5:31 am

    You can use the $this->Paginator->options to preserve the passed arguments in the pagination links. Try this code

    <div class="paging">
        <?php $this->Paginator->options(array('url' => $this->passedArgs)); ?>
        <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
        <?php echo $this->Paginator->numbers();?>        
        <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spring action that I am rendering some json from the controller,
I'm have an action /json that returns json from the server. Unfortunately in IE,
I have created a repository that is returning data from my database using Entity
From within my controllers action, do I have access to httpcontextbase? I have a
I have a custom validation attribute derived from action filter attribute. Currently the attribute
Right now I have a single sound playing from one action, button press, accelerometer,
I have a requirement to supply values from 2 select boxes to an Action
I have an action method that depending on some conditions needs to return a
Lets say I have a controller which provides search functions for a student: public
I have a controller sessions that can create session. I'd like to call it

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.