Welcome Guest, Not a member yet? Register   Sign In
Nettuts CI Day 7 - Pagination Problem
#1

[eluser]domoench[/eluser]
Hi All,

I'm working through the Nettuts Day 7 Tutorial, and the pagination links are not showing up when I load my view.

My code is as follows:

Controller: site.php
Code:
<?php

class Site extends CI_Controller
{
    function index()
    {
        $this->load->library('pagination');
        
        $config['base_url'] = base_url() . 'site/index/';
        $config['total_rows'] = $this->db->get('data')->num_rows();
        $config['per_page'] = 10;
        $config['num_links'] = 20;
        
        $this->pagination->initialize($config);
        
        $data['records'] = $this->db->get('data', $config['per_page'], $this->uri->segment(3));
        $this->load->view('site_view', $data);

    }
}

View: site_view.php
Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;

&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;Title&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    <div id="container">
        <h1>Super Pagination With CodeIgniter</h1>
        &lt;?php echo $this->pagination->create_links(); ?&gt;
    </div>
&lt;/body&gt;

&lt;/html&gt;

My Setup:
- config.php: Set my base url- 'http://localhost/ci_day7/index.php'
- database.php: Set my hostname, username, password, and database db variables.
- autoload.php: loaded 'database' library, and 'url' helper

Does anything above stick out as a reason why the <h1> would display in the view, but the $this->pagination->create_links() line does not?


Messages In This Thread
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-10-2011, 09:17 AM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-10-2011, 10:05 AM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-10-2011, 12:36 PM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-10-2011, 01:24 PM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-10-2011, 01:31 PM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-11-2011, 09:56 PM
Nettuts CI Day 7 - Pagination Problem - by El Forum - 04-12-2011, 05:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB