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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:38:16+00:00 2026-06-07T12:38:16+00:00

I have read all questions on Stackoverflow and have seen no definitive answer to

  • 0

I have read all questions on Stackoverflow and have seen no definitive answer to the question. I am currently using the codeigniter pagination library to generate my pagination links using a limit and an offset:

$config['base_url'] = base_url() . 'explore/featured/index/';
    $config['total_rows'] = $this->Projects_model->get_featured_count();//Count featured projects
    $config['per_page'] = 12;
    $config['uri_segment'] = 4;
    $config['display_pages'] = FALSE;
    $config['next_link'] = 'Older →';
    $config['prev_link'] = '← Newer';
    $this->pagination->initialize($config);
    $limit = $config['per_page'];
    $offset = $this->uri->segment(4);

    $data['pagination'] = $this->pagination->create_links();

    $data['projects'] = $this->Projects_model->get_featured($limit, $offset); //get featured projects from database

The above code limits the output values of my query and uses an offset that is contained in my 4th URI segment.

How can I change the below code to page numbers??? Appears to be impossible because i would be no longer able to use an offset in my 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-06-07T12:38:17+00:00Added an answer on June 7, 2026 at 12:38 pm

    At some point, CI updated their pagination library to (finally) accommodate for this:

    $config['use_page_numbers'] = TRUE;

    By default, the URI segment will
    use the starting index for the items you are paginating. If you prefer
    to show the the actual page number, set this to TRUE.

    If you are on a version that does not have this feature and are unable to update your entire CI installation, you should be able to just drop in the latest pagination library.

    To calculate your DB offset, use $limit * $page_number where “page_number” is the value in your URL (4th segment in your case).

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

Sidebar

Related Questions

I have read more than 3 questions here in stackoverflow about this, but all
First of all let me tell you that i have read the following questions
Questions exactly like this have been asked before, i've read them all and tried
Okay guys, I have read through all the other posts and question on jQuery
I have read all threads about this without finding any answer to my problem.
I have read a number of questions and answers, including this one on StackOverflow
I read all Questions on stackoverflow that could give me a hint with this
I read quit a few Stackoverflow Questions about building mergemodules via commandline but all
I have read lots of questions and answers about this issue on StackOverflow, but
I have read all the documentation I found on how to integrate Unity3D projects

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.