Welcome Guest, Not a member yet? Register   Sign In
Serial No in Pagination library
#1

[eluser]aruntvla[/eluser]
when i use Pagination library , seial no in each page again starting with 1,2,3...plz give me an idea to display it in an order.....
#2

[eluser]Ben Edmunds[/eluser]
Some example code would help...
#3

[eluser]aruntvla[/eluser]
Code:
<?php
         $s=0;
        if(isset($result)){ for($i=0;$i<count($result);$i++)
        {
        $s++;
         ?&gt;
         <tr height="37" style="background-color:#DBF1FE;">
        
             <td align="center" style="border:#94D5FC solid 1px;  padding:5px;"> <b>&lt;?php echo $s; ?&gt;</b></td>
             <td align="center" style="border:#94D5FC solid 1px;  padding:5px;"> <b><a >eventid; } ?&gt;">&lt;?php if(isset($result)){ echo $result[$i]->eventname; } ?&gt;</a></b></td>
             <td align="center" style="border:#94D5FC solid 1px;  padding:5px;"><b>&lt;?php if(isset($result)){ echo $result[$i]->eventdate; } ?&gt;</b></td>          
            
        </tr> &lt;?php
             }
             }
             ?&gt;
            
         </table>
        <div style="font:Verdana, Arial, Helvetica, sans-serif; color:#000000; font-weight:bold; width:925px; float:left;text-align:center; margin-top:10px;">
    &lt;?php echo $this->pagination->create_links(); ?&gt;</div>



When i running this code it gives me serial no as 1,2,3,...but adding pagination to this code for each page it again starts with 1,2,3....plz give me a suggestion to this problem........
#4

[eluser]Rahul Anand[/eluser]
http://ellislab.com/codeigniter/user-gui...ation.html

check this out....

$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = '200';
$config['per_page'] = '20';

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

echo $this->pagination->create_links();
..................................................
you have to mention the total number of rows and also the no of records to be displayed per page.
#5

[eluser]aruntvla[/eluser]
Anand.......my controller code look like this


Code:
&lt;?php
    class eventlisting extends Controller{
    function __construct()
       {
       parent::Controller();
       $this->load->helper('url');
       $this->load->database();
       }
        function index($page=0)
        {
       $this->load->helper('url');
       $this->load->library('pagination');
         $config['base_url'] = ''.base_url().'index.php/eventlisting/index/';
         $config['total_rows'] = $this->db->count_all('eventdetail');
        $config['per_page'] = '5';
       $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $this->pagination->initialize($config);
        $this->load->model('eventlisting_model');
       //$data['page_title'] = "Member listing!";
       $data['result'] = $this->eventlisting_model->getData($config['per_page'],$page);
       $this->load->view('eventlisting',$data);
        }
    }
?&gt;


but how to display serial no in view page??????? :roll:




Theme © iAndrew 2016 - Forum software by © MyBB