• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination

#41
[eluser]Computerzworld[/eluser]
Here is my customized paging plugin which can be used to display paging with different looks like link, combo & textbox.

You can use & customize it in this way.

Code:
Controller,

$paging = paging($this->page,$this->mdl_test->limit,$this->mdl_test->total,$this->mdl_test->numpages);

$this->nav = create_links($paging,"link",3,$this->page); //
parameters : paging array,"path with parameters",style,page no

Model,


if($this->paginate==TRUE)
  {
  $this->total = $this->db->count_all_results("table");
  $this->numpages = ceil($this->total / $this->limit);

  $offset = ($this->page * $this->limit) - $this->limit;
  $this->db->limit($this->limit, $offset);

  }

Javascript function

function setPageNumber(e,path,pageNo,first,last)
{
var unicode=e.charCode? e.charCode : e.keyCode

if(unicode == 13)
{
  if(eval(pageNo) > eval(last))

  {
  [removed].href= path+'/page/'+last;
  }
  else if(eval(pageNo) < eval(first))

  {
  [removed].href= path+'/page/'+first;
  }
  
  else
  {
  [removed].href= path+'/page/'+pageNo;
  }
}

if ((unicode<48||unicode>57) && unicode!=8 && unicode!=9 && unicode!=35 && unicode!=36 && unicode!=37 && unicode!=39)
{

  return false //disable key press
}

}

Paging plugin is attached along with this post which is modified version of paging plugin that is available on wiki. Please see it & share your reviews.

Thanks.

#42
[eluser]Computerzworld[/eluser]
in this code [removed] indicates w1ndow.location

plz replace 1 with i as it doesn't allow this keyword to be used...

#43
[eluser]srajibtechno[/eluser]
i am facing this problem... i am attahced my code here please check it...
i want to add pagination here. i am passing cat_id as a parameter using URL.... how can i add pagination here.... please help me as soon as possible....

My model:

function show_mix_gallery_IT()
{
$this->db->select('*');
$this->db->from('inbook_mix_gallery_sub_category');
$this->db->where('cat_id','1');
$query = $this->db->get();
return $query->result();
}

My Controller:

function IT_details($id)
{

$data['query']=$this->get_model->show_mix_gallery_details($id);

$data['query2']=$this->get_model->show_mix_gallery_category($id);

$this->load->view('inbook_magazine_inner3',$data);
}

and My view is:

&lt;?php

$i=0;
foreach($query->result_array() as $row_)
{
$i++;
?&gt;
<tr >
&lt;? if($row_['mix_gallery_image']==0)
{
?&gt;
<img src="&lt;?=base_url()?&gt;assets/images/&lt;? echo $row_['mix_gallery_image'];?&gt;" align="middle">

<div style="margin-left:15px;margin-right:15px;">

<font color="black">
&lt;? echo $row_['mix_gallery_details'];?&gt;
</font> </div>
<br />
</tr>
&lt;? }
else {?&gt;

<div style="margin-left:15px;margin-right:15px;"> <font color="black"> &lt;? echo $row_['mix_gallery_details'];?&gt; </font> </div>
&lt;? }}
?&gt;


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.