Join Jon Peck for an in-depth discussion in this video Displaying a magazine, part of Up and Running with PHP CodeIgniter (2013).
Earlier I created a view for presenting content to separate presentation from logic.…One of the key features of Codelgniter views is the ability to pass data to the…view for rendering in a standardized way. Data can be passed either as an array or…an object. I'm going to create a view that renders a…magazine, but firs tI'll need to pass data to the view.…When data is passed to the view the keys and array or the parameters of an object…are accessible as variables with the same name, which can be really handy.…Since an issue relates to a publication I'm going to pass both the issue and the…publication to the view. So, I'll just use an array.…
A more complex implementation that I'm not going to demonstrate but something to keep…in mind would be to use lazy instantiation and actually load the publication from the…issue model. I'll keep it simple for now.…Switch the ID, and make sure that you have the magazine controller open.…In the index method, let's wipe everything out, and start fresh.…I'm going to start with the variable data containing an array that I'll pass to the view.…
Starting with the what and why of CodeIgniter, Jon introduces key concepts such as the MVC pattern and libraries by demonstrating how to create static pages, then storing and displaying magazine info in a database. Advanced topics like classes and helpers are explored to validate user input, upload files, and much more. By creating a complete system, you'll have the foundation to build your own applications with CodeIgniter.
- What is CodeIgniter?
- Creating a static page controller
- Generating output with a view
- What is a model?
- Saving data with Active Records
- Creating forms
- Validating user input
- Listing records in tables
- Uploading images
- Viewing and deleting records