Welcome Guest, Not a member yet? Register   Sign In
pagination help
#11

[eluser]theprodigy[/eluser]
print_r your $data array after adding the call to create_links() to see what is being passed back to your pagination element:
Code:
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
print_r($data);  // <---- add this here
$this->load->view('stocks_view',$data);

if it's adding the correct data (looks to be 2 pages), try adding the print_r() to your $pagination variable in your view.
#12

[eluser]sasori[/eluser]
@theprodigy & @Maria Claria

i did tried to analyze and print the $data
Code:
$this->load->model('stock_model');
      $per_page = 10;
      $total = $this->stock_model->count_posts();
      $data['stocks'] = $this->stock_model->getStocks($per_page,$this->uri->segment(3));
      $this->load->library('pagination');
      $config['base_url'] = 'http://myapp/welcome/stocks/';
      $config['total_rows'] = $total;
      $config['per_page'] = $per_page;
      $config['uri_segment'] = '3';
      $this->pagination->initialize($config);
      $data['pagination'] = $this->pagination->create_links();
      print_r($data);
      $this->load->view('stocks_view',$data);

view
Code:
&lt;?php echo $pagination;  ?&gt;
i was getting this
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined variable: pagination

Filename: views/stocks_view.php

Line Number: 31

i dunno why was 'pagination' is undefined when i already included it on the controller $data array
#13

[eluser]maria clara[/eluser]
that means it has a null value. the scripts are not reading it. you have to declare the $pagination.

try this in your view:
&lt;?=lang('pagination');?&gt;

hope that works.
#14

[eluser]theprodigy[/eluser]
ok, try one more thing, after that, I'm completely lost.

Instead of:
Code:
$this->load->view('stocks_view',$data);
try:
Code:
$this->load->vars($data);
$this->load->view('stocks_view');
#15

[eluser]sasori[/eluser]
@maria clara
i tried &lt;?=lang('pagination');?&gt;
i got a call to undefined function lang error

@theprodigy
I got the same error, it just got moved to line 33
#16

[eluser]maria clara[/eluser]
view:
&lt;?php echo $pagination; ?&gt;

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

$data['pagination'] = $this->pagination->create_links();


$this->load->view('stocks_view', $data);
#17

[eluser]sasori[/eluser]
[quote author="maria clara" date="1263992323"]view:
&lt;?php echo $pagination; ?&gt;

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

$data['pagination'] = $this->pagination->create_links();


$this->load->view('stocks_view', $data);[/quote]

it doesn't work, its the same code i used some hours ago

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined variable: pagination

Filename: views/stocks_view.php

Line Number: 33

line 33 = &lt;?php echo $pagination; ?&gt;
#18

[eluser]maria clara[/eluser]
look at this link http://pinoytech.org/blog/post/paginatio...odeigniter an article about pagination in CI. i have used jquery for my pagination.
#19

[eluser]sasori[/eluser]
that page got a trojan downloader according to my anti-virus.
but anyway, thank you very much to both of you
@maria clara
@theprodigy
for spending sometime helping.
#20

[eluser]John Pantoja[/eluser]
Got hit with the av block as well, sucks as I'm getting around to this topic soon. Wonder if it's the common attack on Filipino sites (have to remind el wifo again not to visit her pr0n sites).




Theme © iAndrew 2016 - Forum software by © MyBB