Welcome Guest, Not a member yet? Register   Sign In
Flushing with code ignitor?
#11

[eluser]CroNiX[/eluser]
Code:
echo $this->load->view('view_file', $data, TRUE);
Will bypass buffering entirely, as WanWizard eluded to. If the 3rd parameter is set to TRUE, it returns the view instead of buffering it for final output, so you can directly echo it out or assign it to another variable that gets passed to a template or whatever.
#12

[eluser]Tybion[/eluser]
Thanks, CroNiX, for your help.

Unfortunately, this does not work for me in CI 2.1.0. The following code creates the page CONTENT exactly as it should, but it does not get updated in the browser until the whole page has arrived (about 8 seconds).

(Also, in my rpt_table.php view, all of the table creation - 6,000 rows - is done with echo statements, but using the echo statements does not prevent the output being buffered.)

Code:
public function report($page) {                         // routes.php: $route['warehouse/(:any)']='warehouse/view/$1'
    if ($page=='drillhole') {
      $object=$this->drillhole_model;
    } else {
      die("<br />No report available for $page<br />");
    }
    $data=$object->get_params();           // set minx, base_url, etc. in session variables
    $data['query'] = $object->get_data($data);    // query object
    $data['title'] = 'Data Warehouse';
    echo $this->load->view('templates/rpt_header', $data, TRUE);       // views/templates/rpt_header.php
    echo $this->load->view('warehouse/rpt_table', $data, TRUE);       // views/warehouse/rpt_table.php - TRUE=return data instead of writing to browser.
  }




Theme © iAndrew 2016 - Forum software by © MyBB