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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:31:07+00:00 2026-05-28T13:31:07+00:00

I have a controller function that displays all records, I am using the pagination

  • 0

I have a controller function that displays all records, I am using the pagination class to divide the records in pages. The controller looks a bit like that

class Example extends CI_Controller {

     [...]

     function All()
     {
       //Gets all the records
      //Pagination uri_segment set to 3
     }
}

Now i added the ability to search the records. I need the search term to be in the uri so the function is like function All($search_term = false). My issue is that the function may or may not have search terms. and depending on that, the uri segment of the pagination will change. without a search term uri_segment is 3, with it is 4.

Is there a way to fix that while using the same function and having the search term in the url?

  • 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-05-28T13:31:08+00:00Added an answer on May 28, 2026 at 1:31 pm

    It can be done various ways, personally I would do something simple like store it in session or cookie, but you can do URI as well refer to the CI forum for this one:
    http://codeigniter.com/forums/viewthread/59364/

    Keep in mind that people may type non URI friendly strings into your search term and you will have to urlencode / decode the values in order to put them in a string, something you don’t need with cookies, or sessions. But again I see the benefit for copy & pasting the link to someone for search results.

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

Sidebar

Related Questions

I have this function on my controller (Im using CodeIgniter) that reads the database,
I'v built a application using codeigniter and I have a message system that displays
I have a controller insert action: <AcceptVerbs(HttpVerbs.Post)> _ Function InsertObject(<Bind(Exclude:=Id)> <ModelBinder(GetType(CustomModelBinder))> ByVal object As
I have a simple unsubscribe function in my Unsubscribed controller. if ($this->Unsubscribe->save($this->data['Unsubscribes'])) { //
I have a controller with an action method as follows: public class InventoryController :
I have a controller action that is being executed by a link that was
I have a controller action which I would like to call another controller action.
I have a two classes, a controller called AppController and a class called URLDelegate
Okay so, I'm working with CodeIgniter. posts.php is my view that displays all the
I have the following situation: I have an event handler, that displays small messages

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.