Welcome Guest, Not a member yet? Register   Sign In
Pagination config file having no effect
#1

[eluser]surfgatinho[/eluser]
I've built a few sites recently using a pagination config file and they work fine.

However, I'm trying to change an existing site to use a config file for custom pagination and I cannot get it to work.

I've compared it to my existing code in both controllers and views and even set the pagination config as an autoload. I even tried putting an error in the code to check if it was loading (yes when in the aoutoload settings, no otherwise)

Anyway, it's driving me absolutely nuts. Any suggestions?

Thanks,
Chris
#2

[eluser]TheFuzzy0ne[/eluser]
How are you loading the config file? $this->config->load('some_file')?
#3

[eluser]surfgatinho[/eluser]
[quote author="TheFuzzy0ne" date="1246055937"]How are you loading the config file? $this->config->load('some_file')?[/quote]

Every which way! I tried inline and autoload. However, I didn't need either of these on the other sites
#4

[eluser]TheFuzzy0ne[/eluser]
If you're loading it via the config library, then you'll get an error if the config file doesn't exist. So no error = file is being loaded. Then it should just be a case of using $this->config->item('pagination_config') or similar.
#5

[eluser]surfgatinho[/eluser]
It loads but it isn't having any effect! I put an error in the file to check and it showed up.
It just doesn't seem to be effecting the output
#6

[eluser]TheFuzzy0ne[/eluser]
I think you're going to need to post some code. A problem with the code is the only thing I can think of that would cause such a problem if it's not file permissions, or simply that you're using the wrong URL. I do that all the time...
#7

[eluser]surfgatinho[/eluser]
This is what I have in my controller:
Code:
// load pagination class
    $this->load->library('pagination');
    
    $config['base_url'] = site_url('/members/index');
    $config['total_rows'] = $this->db->count_all('fa_user');
    $config['per_page'] = '10';
    $config['uri_segment'] = '3';
    
    

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

In the view:
Code:
<?=$this->pagination->create_links();?>

And here is how the config file is laid out in config/pagination.php:
Code:
$config['full_tag_open'] = '<ul id="pagination">';
//The opening tag placed on the left side of the entire result.

$config['full_tag_close'] = '</ul>';
//The closing tag placed on the right side of the entire result.

//Customizing the First Link
$config['first_link'] = '&lt;&lt;';
//The text you would like shown in the "first" link on the left.

Pagination itself works fine. And AFAIK the settings from the config file should be pulled automatically. That's the way it seems to work on my other sites.
Just can't figure out what I'm doing wrong here
#8

[eluser]TheFuzzy0ne[/eluser]
Could it be a markup error? Surely it would be wiser to define your start tags like this:
Code:
$config['first_link'] = "&lt;&lt;";

It's also recommended you avoid short tags, as not al servers support it, although you can have CodeIgniter parse them for you.

EDIT: I think you've defined your first_link correctly, but the forum is converting it
#9

[eluser]surfgatinho[/eluser]
Well, for the time being I've just hard coded the config settings into the Pagination.php class in the system/library folder




Theme © iAndrew 2016 - Forum software by © MyBB