CodeIgniter Forums
View loading problem - 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: View loading problem (/showthread.php?tid=10948)



View loading problem - El Forum - 08-19-2008

[eluser]CoolGoose[/eluser]
I was trying to load a view from another view and for some reason it breaks the application.
The controller is:
Code:
class Frontpage extends Controller
{
    function __construct()
    {
        parent::Controller();
    }



    function index()
    {
        $this->load->view('partials/header');
        $this->load->view('frontpage', $data);
        $this->load->view('partials/footer');
    }  

}
And in the partials/footer file I've tried to load another view
Code:
$this->load->view('partials/login');

Any ideas ?


View loading problem - El Forum - 08-19-2008

[eluser]Randy Casburn[/eluser]
What scope is $this in your 'partials/footer' view file?

Randy


View loading problem - El Forum - 08-20-2008

[eluser]CoolGoose[/eluser]
Well they should be on the same scope. To be more exact. When i try to load another view (the login one) from a view (the footer) it only shows the login one without the header/frontpage/footer ones.

/le
I tried

Code:
<?php
$this->ci =& get_instance();
$this->ci->load->view('partials/footer');
?>

in the footer. It's the same.


View loading problem - El Forum - 08-20-2008

[eluser]Randy Casburn[/eluser]
Should work fine...but you've not given us a lot to go on.

Quote:for some reason it breaks the application

Based on what you've provided I can't help. More information on the exact error etc. would be more helpful.

Randy


View loading problem - El Forum - 08-21-2008

[eluser]CoolGoose[/eluser]
Well the thing is that it'd doesn't show an actual php error. It only displays the newly loaded view and not the others. So only $this->load->view('partials/login'); gets displayed.


View loading problem - El Forum - 08-21-2008

[eluser]Randy Casburn[/eluser]
turn on error reporting in CI...let's see what CI reports then.