[eluser]babazumbula[/eluser]
Here's my problem
In contoller I have:
Code:
function members_area(){
$data = array();
$this->load->model('membership_model');
// pagination
$this->load->library('pagination');
$config['base_url'] = base_url().'site/members_area/';
$config['total_rows'] = $this->db->get('data')->num_rows();
$config['per_page'] = 3;
$config['num_links'] = 4;
$this->pagination->initialize($config);
if($query = $this->membership_model->select_all()){
$data['result'] = $query;
}
$data['main_content'] = 'members_view';
$this->load->view('includes/template',$data);
}
In view:
Code:
<table>
<?php if(isset($result)) : foreach($result as $res) : ?>
<tr><td class="nas"><?php echo $res->title; ?></td><td><a class="edit">id ?>">edit</a></td><td><a class="delete">id ?>">delete</a></td></tr>
<tr><td class="kon"><?php echo $res->contents; ?></td></tr>
<?php endforeach; ?>
<?php else : ?>
<p class="nothing">Nothing in db</p>
<?php endif;?>
</table>
<?php echo $this->pagination->create_links(); ?>
What this does is dynamically pull out all rows from db and display them on the page. When I load the page for the first time(when I call function members_area()) edit and delete links work well since href is
Code:
http://localhost... /site/edit/$id
and
Code:
http://localhost... /site/delete/$id
but after I click on any pagination link it somehow interfere with edit and delete links,for they just won't work anymore. Now the link points to
Code:
http://localhost.../site/members_area/edit/$id
instead of
Code:
http://localhost... /site/edit/$id
Basically, calling members_area() and
Code:
$config['base_url'] = base_url().'site/members_area/';
should be the same url, or am I wrong? Seem like I don't understand essence. Pagination works well.