CodeIgniter Forums
Using PHP's "virtual" function messes up CodeIgniter includes? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Using PHP's "virtual" function messes up CodeIgniter includes? (/showthread.php?tid=1925)



Using PHP's "virtual" function messes up CodeIgniter includes? - El Forum - 07-05-2007

[eluser]Unknown[/eluser]
I have a strange problem that I'm seeing on a site. When one of my includes uses PHP's "virtual" function to load some content, some of my other includes don't appear to be included.

Here's a test I created. I have a controller, and in it I put the following action:
Code:
function test_include()
    {
        $data['title'] = "Title";
        $this->load->view('workshops/test_include', $data);
    }
The test_include view looks like this:
Code:
<?php $this->load->view('includes/header'); ?>
    
    <?php $this->load->view('includes/test'); ?>

<?php $this->load->view('includes/footer'); ?>
The problem occurs because of this line in the "header" include:
Code:
<?php virtual("/cgi-bin/breadcrumb.cgi"); ?>

The contents of "includes/footer" do appear on the page, but not the contents of "includes/test". If I remove the call to "virtual" from "includes/header", then everything works as expected.

Any idea why this would happen or how to work around it?


Using PHP's "virtual" function messes up CodeIgniter includes? - El Forum - 07-05-2007

[eluser]Bulk[/eluser]
I would imagine it has something to do with the fact that calling virtual() causes all internal php output buffers to be flushed, and as the CI output/loader classes makes use of those buffers in its output it causes the output to terminate early - thus your odd results...