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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:15:57+00:00 2026-05-26T02:15:57+00:00

I am still learning with the CodeIgniter framework. Today, I find myself faced with

  • 0

I am still learning with the CodeIgniter framework. Today, I find myself faced with the problem of pagination.

Indeed I would have access to data via an id which requires a variable in the url and another one for the pagination.

This is my foos_by_day function (this is not the real name, it’s just an example) in my controller called foo that returns an array of foos on a specific day.
These foos come from my database and go to my controller get_foos_by_day ($day) via the model called model_foos.

function foos_by_day($day) {
    $configpages['base_url'] = 'http://www.exemple.com/ci/index.php/foo/foos_by_days/'.$foo."/";
    $configpages['total_rows'] = count($this->model_foos->get_foos_by_day($foo));
    $configpages['per_page'] = 10;
    $config['uri_segment'] = 4;

    $this->pagination->initialize($configpages);
    $data['foos'] = $this->model_foos->get_foos_by_day($jour, (int)$this->uri->segment(4), $configpages['per_page'] );

    $this->load->view('foo_view.php', $data);
}

And this is my view:

<?php foreach ($foos as $element): ?>
    <div>
    Name of the foo : <?=$element->name?><br />
    Date of the foo : <?=$element->date?><br />
    </div>
<?php endforeach; ?>
<?php echo $this->pagination->create_links(); ?>

I get something strange in my view when I input : http://www.example.com/ci/index.php/foo/foos_by_day/2011-09-28/

The numbering of my 32 foos starts at 4 (the last page). It displays correctly 10 foos per pages but when I click on another page, the selected page stays the fourth.
Moreover, the links behind the page numbers gives me the following statement:

<a href="http://www.example.com/ci/index.php/foo/foos_by_day/2011-09-28/">First</a>
<a href="http://www.example.com/ci/index.php/foo/foos_by_day/2011-09-28/20">&lt;</a>
<a href="http://www.example.com/ci/index.php/foo/foos_by_day/2011-09-28/10">2</a>
<a href="http://www.example.com/ci/index.php/foo/foos_by_day/2011-09-28/20">3</a>
<strong>4</strong>

So : nothing, then 20, 10 and 20 (again). In short there is a bug in the pagination.

Have you ever been faced to this kind of situation (with a pagination error)? If so, how did you solve it?
How do you think I should proceed to find a regular pagination?

Thanks in advance.

P.S. : I didn’t delete the index.php file but I have learned to do it on an other CodeIgniter.

  • 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-26T02:15:57+00:00Added an answer on May 26, 2026 at 2:15 am

    Change
    $config['uri_segment'] = 4;
    to
    $configpages['uri_segment'] = 4;

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

Sidebar

Related Questions

I'm still learning about jQuery, but I have not been able to find a
Okay I'm still learning the ropes with the Entity Framework and I came across
I'm still learning Grails and seem to have hit a stumbling block. Here are
I'm kind of new with CodeIgniter and I'm still learning (a lot). So I
I'm still learning Rhino mocks and have a question about it. For example -
I am still learning MySQL queries and am stuck with this one. I have
I'm still learning (baby steps). Messing about with a function and hoping to find
Still learning the MySQL ropes and I'm trying to find out how to do
I am still learning ASP.NET MVC. With webforms, I would create a new folder
Still learning haskell, and I cannot really see the difference between data Tree 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.