![]() |
rookie problem - 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: rookie problem (/showthread.php?tid=14072) |
rookie problem - El Forum - 12-17-2008 [eluser]mortifrog[/eluser] Hi, I've been using PHP quite successfully for a number of years but am new to OO and programming with any sort of framework. I think if I can crack this CI methodology, I will be on fire, but so far I'm just managing the odd spark! Can someone tell what's wrong with the following code please? Code: class Welcome extends Controller { CI gives me an error of: Undefined variable: content and PHP chucks up - Cannot access empty property in .... It seems to me as if I have defined a property named q_page and am asking to load it's contents as a view? I know I must be being dim, but I'm too dim on this occasion to work out why! rookie problem - El Forum - 12-17-2008 [eluser]xwero[/eluser] $ too much rookie problem - El Forum - 12-17-2008 [eluser]mortifrog[/eluser] Doh! thanks! The crazy thing is I didn't spot the difference between my two examples. 0/10 for observation! rookie problem - El Forum - 12-17-2008 [eluser]xwero[/eluser] always check for typos first, it is the most common cause of bugs ![]() rookie problem - El Forum - 12-17-2008 [eluser]Colin Williams[/eluser] It also helps to have a good IDE. Mine would flag that with the warning "The local variable $content may not have been initialized" rookie problem - El Forum - 12-17-2008 [eluser]mortifrog[/eluser] It was a complete howler and I feel suitably embarrased for posting it! I always do check for typos - but sometimes, you can't see the wood for the trees when you're a little stressed! I'm not keen to change my editor just yet though as I've only just dicovered it and apart from not picking up that typo, it seems to be the best PHP editor I've ever used - it's phpDesigner - unless you can tell me something that's better. ( I used to use Homesite, and I still use Dreamweaver for some stuff) |