[eluser]ludo31[/eluser]
Hello ,
I would like to show one page the value of this array and create pagination according to that
in my controller :
Code:
function index(){
$data['rows']= array('id'=>array(12,13,14,15,16,17,18,19,20,21,23,24,25,15,26,29,27,29,30,31));
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/CodeIgniter/';
$config['total_rows'] = count($data['rows']['id']);
$config['per_page'] = 5;
$config['num_links']=5;
$config['full_tag_open']='<div id="pagination">';
$config['full_tag_close']='</div>';
$config['next_link']='>>';
$config['prev_link']='<<';
$this->pagination->initialize($config);
$this->load->view('essai_grid',$data);
}
and in my view
Code:
<ul>
<?php
// 4 colonnes
//for($j=0;$j<$result;$j++)
$i = 0 ;
$j=0;
while($j<$result)
{
if($i==0)
{
?>
<li class="grid_3 alpha" id="ligne"><?php echo $rows['id'][$j];?></li>
<?php
$i++;
}
else
{
if($i==3)
{
$i =0;
?>
<li class="grid_3 omega" id="ligne"><?php echo $rows['id'][$j];?></li>
<div class="clear"></div>
<?php
}
else
{
?>
<li class="grid_3" id="ligne"><?php echo $rows['id'][$j];?></li>
<?php
$i++;
}
?>
<?php
}
$j++;
}
?>
</ul>
</div>
<div class="clear"></div>
<div class="grid_12">Navigation</div>
<?php echo $this->pagination->create_links();?>
so as I can do research I found code in controller about pagination where it is basin on database so he adds :
Code:
$this->pagination->initialize($config);
$data['page']= $this->db->get('gnr_convenir', $config['per_page'], $this->uri->segment(3));
$this->load->view('homme_view',$data);
so What can I make instead of
Code:
// gnr_convenir is a table but me I woud just an array
$data['page']= $this->db->get('gnr_convenir', $config['per_page'], $this->uri->segment(3));