Welcome Guest, Not a member yet? Register   Sign In
Table class produces no output
#1

[eluser]Unknown[/eluser]
>>> Update
Replacing
Code:
echo $this->table->generate($results);
with
Code:
echo $this->table->generate();
produces an empty table.

So, it looks like the $results is killing table.
However, the for loop in people_page_view is quite happy with the table.

Any ideas??????????????


A view is loaded with
Code:
echo $this->table->generate($results);
The $results array contains the expected query result - shown by debug foreach loop
No output is produced by table->generate

Can anyone see what I've done wrong?

Les


Code:
Here's people_page.php
<?php
/* General purpose display of 20 people
* Used to browse and to show new list after update
*/
class People_Page extends CI_Controller {

    public function __construct() {
        parent:: __construct();
        $this->load->model("people_model");
        $this->load->library("pagination");
    }

    public function index()
{
  echo 'Hello People_Page!';
                $this->get_people();
}

    public function get_people() {
        log_message('debug', '>>> Entered get_people method in People_Page');
        $config = array();
        $config["base_url"] = base_url() . "people_page";
        $config["total_rows"] = $this->people_model->record_count();
        $config["per_page"] = 20;
        $config["uri_segment"] = 3;

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

        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;

        $data['results'] = $this->people_model->fetch_people($config["per_page"], $page);
        // fetch_people returns false if no data
        if (!$data['results']){
            $data['results'] = "No people found";
            log_message('debug', '>>> No people found');
        } else {
            // Get the table class
            $this->load->library('table');

            $this->table->set_heading('First Name', 'Last Name','Cell Phone',
                    'Home Phone', 'Email', 'ZipCode');
           //

            $this->load->view("people_page_view", $data);
        }


    }
}

?>

This is the people_page_view.php
<?php
    log_message('debug', '>>> Entered people_page_view in People_Page: ' . $results . count($results));
    foreach ($results as $row){
        echo '<br>' . $row->LastName . ' | ' . $row->FirstName;
    }
    echo $this->table->generate($results);
    echo $this->pagination->create_links();
?&gt;

Here's the generated page (all from the foreach loop)

Hello People_Page!
Mahler | Glen
Rasmus | David
Rutters | Pattie
Schumacher | Michael
Willenbrink | Jim
Rimpley | Lynn
Binder | Ken
Raney | Matthew
Jensen | Paul
Scott | John
Smith | Lorene
Zimmerman | Raymond
Bieber | Paul
Sanchez | Carlos
Scanlon | Michael
Macleod | Jeff
Baily | Jake
Rausch | Jacob
Pearson | Freya
Sheehan | John

Here's the CTL-U

Hello People_Page!&lt;!-- header.php --&gt;
<br>Mahler | Glen<br>Rasmus | David<br>Rutters | Pattie<br>Schumacher | Michael<br>Willenbrink | Jim<br>Rimpley | Lynn<br>Binder | Ken<br>Raney | Matthew<br>Jensen | Paul<br>Scott | John<br>Smith | Lorene<br>Zimmerman | Raymond<br>Bieber | Paul<br>Sanchez | Carlos<br>Scanlon | Michael<br>Macleod | Jeff <br>Baily | Jake<br>Rausch | Jacob<br>Pearson | Freya<br>Sheehan | John
#2

[eluser]InsiteFX[/eluser]
Please wrap your code in code tags when posting code!

It makes it alot easier to read...




Theme © iAndrew 2016 - Forum software by © MyBB