CodeIgniter Forums
load->view() not working? - 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: load->view() not working? (/showthread.php?tid=4278)

Pages: 1 2


load->view() not working? - El Forum - 11-15-2007

[eluser]jnorris441[/eluser]
I have one line in index() in my members controller:

$this->load->view("member/profile.php");

The view file is in views/member/profile.php

All I get is a blank page? Display_errors is on and error_reporting is E_ALL.

I'm on PHP 4.3.2

I can echo from index() and get output so I know it's being run.


load->view() not working? - El Forum - 11-15-2007

[eluser]jnorris441[/eluser]
Output buffering is on


load->view() not working? - El Forum - 11-15-2007

[eluser]Michael Wales[/eluser]
What's the code within member/profile.php?


load->view() not working? - El Forum - 11-15-2007

[eluser]jnorris441[/eluser]
This gibberish text:




Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In in ligula. Aliquam erat volutpat. Integer arcu massa, hendrerit ac, gravida vel, interdum sit amet, velit. Sed nec sapien. In hac habitasse platea dictumst. Nulla cursus, felis eget tristique hendrerit, lacus turpis laoreet ipsum, vitae posuere lacus felis commodo augue. Cras diam elit, varius in, condimentum eget, mollis nec, lorem. Nam ac odio quis nunc ullamcorper dapibus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc ac velit ac enim vulputate commodo. Vestibulum vulputate metus a turpis sollicitudin feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse elit magna, congue id, vehicula adipiscing, accumsan nec, sapien.

Etiam felis dui, dapibus ut, cursus sed, ultricies vitae, risus. Vestibulum id metus. Fusce enim nulla, rhoncus vel, vestibulum elementum, volutpat sit amet, justo. In luctus erat euismod quam. Fusce tellus purus, tincidunt convallis, convallis ac, tempor at, nisl. Nullam malesuada fermentum nibh. Vestibulum nisi turpis, mollis sed, posuere eu, tincidunt nec, nunc. Mauris congue arcu vitae lacus. Nulla faucibus mollis neque. Donec euismod volutpat sapien. Curabitur rhoncus sapien sit amet purus. Nullam congue sapien et dolor. Nunc ornare nulla ut risus. Proin ipsum dui, varius eu, sodales vel, elementum sit amet, nunc. Integer nisi.


load->view() not working? - El Forum - 11-15-2007

[eluser]Michael Wales[/eluser]
hahaha

I know what it is.... wait for it.... wait for it...

Code:
$this->load->view('member/profile');



load->view() not working? - El Forum - 11-15-2007

[eluser]jnorris441[/eluser]
Thank you for catching that!

I changed it, but I still get a blank page.


load->view() not working? - El Forum - 11-15-2007

[eluser]Michael Wales[/eluser]
Can't believe I didn't see that the first time around...

You still have a blank? You should have the following code - we're going to assume your controller is named home.php:


Code:
<?php

class Home extends Controller {

  // This would be function Home() if you are on PHP4
  function __construct() {
    parent::Controller();
  }

  function index() {
    $this->load->view('member/profile');
  }
}
?>

And your view file is just plain text?


load->view() not working? - El Forum - 11-15-2007

[eluser]jnorris441[/eluser]
Code:
<?
    class Members extends Controller {
    
        function Members(){
            parent::Controller();
            $this->load->model('Members_model');
        }


        function index(){

            
            $this->load->view('member/profile');

        
        }

        
    }

?>



This is the actual code. The view is just plain text.


load->view() not working? - El Forum - 11-16-2007

[eluser]cinewbie81[/eluser]
mind to post profile.php here as well ?


load->view() not working? - El Forum - 11-16-2007

[eluser]mrahman[/eluser]
did you check the model for errors? if this constructor fails then the object will not be useful