Having a problem with $this->load->view(); - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Having a problem with $this->load->view(); (/showthread.php?tid=11257) |
Having a problem with $this->load->view(); - El Forum - 09-01-2008 [eluser]ConnorD[/eluser] Hi, I am fairly experienced in PHP, but brand new to CI, so please bare with me. I have been having no trouble until I tried to load a view from my controller: Code: <?php I am getting an error message on my codeigniter page from my browser saying: "A PHP Error was encountered Severity: Notice Message: Undefined property: Home::$load Filename: controllers/home.php Line Number: 11". I don't understand it, because I have done everything with the tutorials. Any help would be appreciated, thank you. BTW, here is my view if it is of interest: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> Having a problem with $this->load->view(); - El Forum - 09-01-2008 [eluser]Sarfaraz Momin[/eluser] Hi, it seems a very small mistake you made in the code. Check the code below. Code: <?php You have the constructor name different than your class name which I have reversed. It should work now !!! Have a good day !!! Having a problem with $this->load->view(); - El Forum - 09-01-2008 [eluser]ConnorD[/eluser] Thank you for the quick response, it worked! Now that I have pretty much all of the main problems I am having with CI worked out, I am really beginning to like this FW. I am rewriting my whole site currently in CI (just started today), and I have already finished a few pages! I remember when I started my website originally in raw php, it took me days to even get where I am right now in CI! Having a problem with $this->load->view(); - El Forum - 09-01-2008 [eluser]Sarfaraz Momin[/eluser] It indeed is cool stuff. There are a few personal recommendations though. 1. Whenever you have a problem please try to refer the user guide. Trust me it helped me most of the time for conventional things. 2. For issues which are not conventional or I should say is not related to usability problems then the next best thing you do is post here and this great community here would get you someone to help. Have a good day !!! Welcome and enjoy coding in CI !!! Having a problem with $this->load->view(); - El Forum - 09-01-2008 [eluser]Randy Casburn[/eluser] Hi Connor, This indicates the CI super object is not available with this class. The reason is because you don't have a constructor. Rename your index method to __constructor() or to Home() and things will be better. [edit] -- well never mind - I was way slow on the response. Welcome to CI anyway! Randy |