Chapter 4. Creating the Main Web Site
If you've made it this far, congratulations! You've set up CodeIgniter and created the bare-bones models, views, and controllers that you'll need to work on the Claudia's Kids project. At this point, you're probably all done FTPing your CodeIgniter files to the development server. As soon as that process is done, it's time to take a quick look at your work so far.
Before you do that, please note that you are bound to see some errors. These have been left in intentionally so you can learn how to deal with them. By the time you're done with the first few pages of this chapter, you should be able to troubleshoot most common problems you'll encounter during development. With that in mind, load the home page of your nascent application in a browser window. You should see something similar to Figure 4-1.
You can't help but notice the three prominent PHP error blocks. Each error block comes with all the information you need to fix the problem. For example, each block is categorized by severity (two of these are notices) and message (undefined variables or array-to-string conversion). Finally, each error block gives you a file and line number.
In the case of the first error block, there's a problem with array-to-string conversion. What does that mean? Well, it's time to gather some clues. Here's what the index() function of the controller looks like:
function index(){ $data['title'] = "Welcome to Claudia's Kids"; $data['navlist'] = $this->MCats->getAllCategories(); ...
Get Professional CodeIgniter® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.