pagination? |
[eluser]MMCCQQ[/eluser]
hi i using pagination library..and don't work; Controller Code: <?php Code: <?php foreach($noticias->result() as $row):?>
[eluser]Isern Palaus[/eluser]
Hey MMCCQQ, I didn't know how to use the pagination class and I talked to Zaatar, the coder of CodeExtinguisher (check this post: http://ellislab.com/forums/viewthread/67126/). I based my code on the module that he uses and the result was that: Code: <?php The Controller that uses the cmm_m model: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); And the view: Code: <?php I wish that help you. Un saludo, -- Isern Palaus
[eluser]MMCCQQ[/eluser]
how can i get url show/1 not show/10 http://importzona.com/Z-move/seccion/noticias/
[eluser]Jauhari[/eluser]
Just Perfect, but I have little question. How to show all records? the URL and the anchor links?
[eluser]Saymont[/eluser]
Hi, I'm lost with this pagination class too. I tried to see how bambooinvoice.org did but I could not understand. Anyone can help us?
[eluser]Frank Rocco[/eluser]
Here is what I have working. function index() { // Apply where clause $this->db->where('userGroup','HELPDESK'); $config['base_url'] = base_url().'/index.php/welcome/index'; $config['total_rows'] = $this->db->count_all_results('logins'); $config['per_page'] = 3; $config['uri_segment'] = 3; $this->pagination->initialize($config); $offset = (int) $this->uri->segment(3, 0); // Order by user name, asc $this->db->orderby('userName','asc'); $data["query"] = $this->db->get('logins', $config['per_page'], $offset); $data['pagination1'] = $this->pagination->create_links(); $this->load->view('index',$data); } View <?php foreach ($query->result() as $row) { echo $row->userName . '<br/>'; } ?> <br/> <?php echo $pagination1 ?> HTH Frank
[eluser]Saymont[/eluser]
Thank you. How does the pagination class send the information that the $query must list just the $config[’per_page’]?
[eluser]Frank Rocco[/eluser]
The offset tells the query where to start returning records. The per_page tells the query how many records to return. so if the per_page is 5 and yu ar on the first page. When you go to the next page, the offset will be 6 and return 5 more records. This works for mysql, but not for sqlserver 2000. I am trying to find a work around. HTH Frank
[eluser]Saymont[/eluser]
Thank you Frank, But where on the select query the "per_page" is loaded ? I cant find anything about it: take a look: Controller: Code: function index() Model Code: function tickets_abertosTotaisResultado() View (simple): Code: <? foreach($tickets_abertosTotaisResultado as $row): ?> Can anyone help me? Thank you...
[eluser]Frank Rocco[/eluser]
You need to add LIMIT xx OFFSET xx to your query in your model. HTH Frank |
Welcome Guest, Not a member yet? Register Sign In |