Having a problem with $this->load->view(); |
[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">
[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 !!!
[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!
[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 !!! ![]()
[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 |
Welcome Guest, Not a member yet? Register Sign In |