Welcome Guest, Not a member yet? Register   Sign In
Pagenation load
#1

[eluser]viv81ster[/eluser]
I have a problem

C:\Sites\home\codeigniter\www\system\application\controllers\admin\users.php on line 104

A PHP Error was encountered
Severity: Notice

Message: Undefined property: Users::$pagination

Filename: admin/users.php

Line Number: 104

FreakAuth_light 1.1
PHP Version 5.1.2
Apache 2.0

register_globals on
magic_quotes_gpc Off

if paste in Loader.php
816: print_r($CI->$classvar);


[_error_suffix] =>

) CI_Pagination Object ( [base_url] => [total_rows] => [per_page] => 10 [num_links] => 2 [cur_page] => 0 [first_link] => ‹ First [next_link] => > [prev_link] => < [last_link] => Last › [uri_segment] => 3 [full_tag_open] => [full_tag_close] => [first_tag_open] => [first_tag_close] => [last_tag_open] => [last_tag_close] => [cur_tag_open] => [cur_tag_close] => [next_tag_open] => [next_tag_close] => [prev_tag_open] => [prev_tag_close] => [num_tag_open] => [num_tag_close] => )
#2

[eluser]CodyPChristian[/eluser]
Could you please paste your controller & view that have to do with this please. Also this should be in "CodeIgniter Discussion". Good luck Smile
#3

[eluser]viv81ster[/eluser]
Code:
function index()
    {
//$this->load->library('pagination');
        //let's paginate results
        
        $config['base_url'] = base_url().$this->config->item('index_page').'/'.'admin/users';
        $config['uri_segment'] = 3;
        $config['per_page'] = $this->config->item('FAL_admin_console_records_per_page');
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $config['cur_tag_open'] = '<b>';
        $config['cur_tag_close'] = '</b>';
        $config['next_link'] = '&gt;';
        $config['prev_link'] = '&lt;';
        
        $fields='id';
        $query = $this->usermodel->getUsers($fields);
        
        $config['total_rows'] = $query->num_rows();
        
        //$this->pagination->initialize($config);
                $this->load->library('pagination',$config);
        $query->free_result();
            
        $page = $this->uri->segment(3, 0);
        
        $fields= 'id, user_name, role';
        
        $limit= array('start'=>$config['per_page'],
                      'end'=>$page
                        );
        
        $query = $this->usermodel->getUsers($fields, $limit);

        
        if ($query->num_rows()>0)
        {
             $i=1;
             foreach ($query->result() as $row)
            {
                // when do we display links for editing or deleting a user ?
                // we display the edit and delete links if
                // the user in the table is neither a superadmin nor an admin
                $data['user'][$i]['show_edit_link'] =
                    ($row->role != 'admin' AND $row->role != 'superadmin');
                $data['user'][$i]['show_delete_link'] =
                    ($row->role != 'admin' AND $row->role != 'superadmin');
                
                // then we just fill the infos
                $data['user'][$i]['id']= $row->id;
                $data['user'][$i]['user_name']= $row->user_name;
                $data['user'][$i]['role']= $row->role;
                $i++;
            }
            
            $query->free_result();
        }
        else
        {
            // If we arrive here, it means that we have no users in the db
            // hence no ADMIN. But only admins are allowed to
            // use this controller.
            // The only way to arrive here is to log in as an admin,
            // then delete all users 'by hand'
            // (since FAL do not allow it), and try to display the users list.
            show_error('No user in the database. Please reinstall FreakAuth light.');
        }
            
        //let's display the page
        $data['heading'] = 'VIEW users';
        $data['action'] = 'Manage users';
        $data['pagination_links'] = $this->pagination->create_links();
        $data['controller'] = 'users';
        $data['page'] = $this->config->item('FAL_template_dir').'template_admin/users/list';
                        
        $this->load->vars($data);
        
        $this->load->view($this->_container);
        //$this->output->enable_profiler(TRUE);
    }

A PHP Error was encountered
Severity: Notice

Message: Undefined property: Users::$pagination

Filename: admin/users.php

Line Number: 154


Fatal error: Call to a member function create_links() on a non-object in C:\Sites\home\codeigniter\www\system\application\controllers\admin\users.php on line 154

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

[eluser]CodyPChristian[/eluser]
Honestly I can't see the issue, it all *looks* okay so far, however I've never used

$this->load->library('pagination',$config);

I always do this:

$this->load->library('pagination');

$this->pagination->initialize($config);

$this->pagination->create_links();

Other then that, I don't see what is causing the error, everything looks normal.
#5

[eluser]viv81ster[/eluser]
replace

$this->load->library('pagination');
$this->pagination->initialize($config);
//$this->pagination->initialize($config);

but nothing changing Sad

I think, problem in PHP settings.
#6

[eluser]CodyPChristian[/eluser]
Okay, well try this, move all of the pagination stuff to one block instead of spacing it out all over the place.

Structure it more like this:

Sample Pagination (That works)
#7

[eluser]viv81ster[/eluser]
don't work

I create new controller

&lt;?php
class test extends Controller {

function index()
{
$this->load->library('pagination');

$config['base_url'] = 'http://www.your-site.com/index.php/test/page/';
$config['total_rows'] = '200';
$config['per_page'] = '20';

$this->pagination->initialize($config);

echo $this->pagination->create_links();
}
}

but

A PHP Error was encountered
Severity: Notice

Message: Undefined property: test::$pagination

Filename: controllers/test.php

Line Number: 12
$this->pagination->initialize($config);
#8

[eluser]tonanbarbarian[/eluser]
you do not have a constructor in the controller (or at least in the code you have posted here)

Code:
&lt;?php
class test extends Controller {

function test() {
parent::Controller();
}

function index()
{
$this->load->library(’pagination’);

$config[’base_url’] = ‘http://www.your-site.com/index.php/test/page/’;
$config[’total_rows’] = ‘200’;
$config[’per_page’] = ‘20’;

$this->pagination->initialize($config);

echo $this->pagination->create_links();
}
}
#9

[eluser]viv81ster[/eluser]
[quote author="tonanbarbarian" date="1200493637"]you do not have a constructor in the controller (or at least in the code you have posted here)

Code:
&lt;?php
class test extends Controller {

function test() {
parent::Controller();
}

function index()
{
$this->load->library(’pagination’);

$config[’base_url’] = ‘http://www.your-site.com/index.php/test/page/’;
$config[’total_rows’] = ‘200’;
$config[’per_page’] = ‘20’;

$this->pagination->initialize($config);

echo $this->pagination->create_links();
}
}
[/quote]
this is don't impact on error Sad




Theme © iAndrew 2016 - Forum software by © MyBB