Part of the EllisLab Network
   
 
Pagination create_links() will not appear
Posted: 28 June 2009 07:45 AM   [ Ignore ]  
Summer Student
Total Posts:  29
Joined  05-25-2009

Hey, I’m have been creating a comments system for my site today and I cannot get the pagination links to appear. I have managed to get the links to appear in the past but not now. The only thing different is that I am coding this as a library not a controller.

This is my library function:

// Library = Ludatha
function getComments($type$id$url$colspan 1$offset 0$perPage 10){
        $CI 
=& get_instance();
        
$offset2 $offset $perPage;
        
$query $CI->db->query("SELECT * FROM comments WHERE forId = '$id' AND type = '$type' LIMIT $offset$offset2");
        
$comments '';
        if (
$query->num_rows() > 0)
        
{
            $config[
'base_url'$this->baselink $url;
            
$config['total_rows'$query->num_rows();
            
$config['per_page'$perPage;
            
$config['uri_segment'4;
            foreach (
$query->result() as $row){
                $comments 
.= '<tr><td colspan="'.$colspan.'">comments</td></tr>';
            
}
            $CI
->pagination->initialize($config); 
            
$comments .= '<tr><th colspan="'.$colspan.'">'.$CI->pagination->create_links().'</th></tr>';
        
}else{
            $comments 
.= '<tr><td colspan="'.$colspan.'">There are no comments yet.</td></tr>';
        
}
        
return $comments;
    
$this->ludatha->getComments(11$this->ludatha->baselink "profile/view/" $username3$comOffset


The data appears, and when I add /10 to the end of the URL the next 10 results are displayed. The only thing wrong is the fact that the create_links() function will not show anything at all.

My errors are generally ones that I cannot see but are pretty simple, so I am sorry if this is a simple thing to fix :)

Can anyone shed any light?

Thanks

- Adam

Profile
 
 
Posted: 29 June 2009 07:15 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  29
Joined  05-25-2009

Can anyone shed any light on this?

Profile
 
 
Posted: 19 November 2011 07:00 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  217
Joined  02-09-2010

I’m having a similar problem right now, where the $this->pagination->create_links() won’t display the pagination. However, when I print_r($this->pagination) all of the data is there.

Profile
 
 
Posted: 30 November 2011 02:53 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  10
Joined  08-23-2010

Edit: Figured it out…

Profile
 
 
Posted: 30 November 2011 02:58 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  10
Joined  08-23-2010

Sorry, I just realized this thread was posted in the wrong forum. Could an admin please move this thread? Thank you.

Profile