Welcome Guest, Not a member yet? Register   Sign In
Pointing to a table record number? Still Open (See pg 2)
#11

[eluser]SpooF[/eluser]
Code:
function display($current = 0)
    {
        $config['base_url'] = 'http://example.com/index.php/controller/display/';
        $config['total_rows'] = $this->db->count_all('entries');
        $config['per_page'] = '1';
        $this->pagination->initialize($config);
        
        $data['pagein'] = $this->pagination->create_links();
        $data['query'] = $this->db->get('entries',1,$current);

        $this->load->view('controller',$data);
    }
Put this in your constructor:
Code:
$this->load->library('pagination');
#12

[eluser]JPrieto[/eluser]
thank you
thank you
thank you

wow -- it works

oops, sorry about the "wow"

lol

just one question....

page 2 is NOT linkable whenever I am in page 1

but page 2 is linkable from any other page

why you think this is so?

thanks
#13

[eluser]SpooF[/eluser]
Are you sure your on page 1? The number that is displayed in the URL is where the sql starts, so add 1 to it and it will give you your current page. Thats why its defaults to 0 in the display function.
#14

[eluser]JPrieto[/eluser]
page 1 displays as soon as i go to the site
but page 2 is never linkable when in page 1

page 2 is linkable when i'm in any other page [except when in page 1]
#15

[eluser]SpooF[/eluser]
Did you edit the code? Also when you go to page 1, what is the url in the address?
#16

[eluser]JPrieto[/eluser]
[quote author="SpooF" date="1243834273"]Did you edit the code? Also when you go to page 1, what is the url in the address?[/quote]

yes i edited
everything works fine

except that page 2 is never linkable when in page 1

when in page 1 the url is exactly this

http://localhost/site1/index.php/products/display/

when in page 2 the url is this

http://localhost/site1/index.php/products/display/1


when in page 3 the url is this

http://localhost/site1/index.php/products/display/2

etc

so....

everything works fine

except that page 2 is never linkable when in page 1

how can i fix it?

thanks
#17

[eluser]SpooF[/eluser]
Past the code you are using
#18

[eluser]JPrieto[/eluser]
[quote author="SpooF" date="1243834919"]Past the code you are using[/quote]

=========================
VIEWS FILE
=========================
Code:
<html>
<head>
<title>Arte</title>
</head>
<body>
<?php

  echo $this->pagination->create_links();
  echo '<br>';
  
   $row = $query->row_array();
   echo $row['item'];
   echo $row['price'];
   echo $row['titulo'];
   echo '<br>';
?&gt;

<img src="http://localhost/site1/images/&lt;?php echo $row['photo'];?&gt;" width='500'><p>


&lt;?php
echo $row['desc'];
?&gt;

&lt;/body&gt;
&lt;/html&gt;

==============================
CONTROLLER
==============================
Code:
&lt;?php
Class Products extends Controller
{
  
    Function Products()
    {
        parent::Controller();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->scaffolding('productos');
        $this->load->library('pagination');
        $data['query']= $this->db->get('productos');
        $config['total_rows'] = $this->db->count_all('productos');
          
     }


    Function index()
    {
       $data['title']= "Arte";
       $data['heading']= "CATALOG";
       $data['query']= $this->db->get('productos');
       $this->load->view('products_view',$data);
      
              
    
    }

    function display($current = 0)
    {
        $config['base_url'] = 'http://localhost/site1/index.php/products/display/';
        $config['total_rows'] = $this->db->count_all('productos');
        $config['per_page'] = '1';
        $this->pagination->initialize($config);
        $data['pagein'] = $this->pagination->create_links();
        $data['query'] = $this->db->get('productos',1,$current);
        $this->load->view('products_view',$data);
    }


}
?&gt;

I am applying your code to a page that displays a product with a title,desc,price,image

one product per page

thanks
#19

[eluser]JPrieto[/eluser]
i just noticed also that

when in page 1 page 1 is still linkable while page 2 is not - but page is indeed in bold

whereas

when in any other page -- except page 1 - the page i'm in is in bold and not linkable

but

page 1 is still linkable when I am in it
and page 2 is not linkable but is in bold
#20

[eluser]JPrieto[/eluser]
i simplified views file for easier debugging

it is as i use it now

page 2 problem when in page 1 still there




Theme © iAndrew 2016 - Forum software by © MyBB