Join Jon Peck for an in-depth discussion in this video Listing magazines with tables, part of Up and Running with PHP CodeIgniter (2013).
- View Offline
The HTML table class, generates HTML tables from arrays or database results sets.…The table class is initialized in the controller, using this load library table.…Once it's loaded it can be accessed using this table.…While I can technically call the library class from within the controller, it's…best practiced to keep display in the view.…Going back to the IDE, I'm going to take a look again at the magazine controller…index method. Right now there's a bunch of hard coded…stuff, instead I'm going to replace it with something a lot more flexible.…
I'll start by loading the library for table.…This load, library, table. Next, I'm going to build an array of…magazines for table library to render, magazines equals array, I will load the…models for both the issue and the publication by passing in a array, this…load model then a array containing issue and publication.…Then I'll get all the issues that are known in the database.…
Issues, equals, this, issue, get, foreach, issues as issue, instantiate a…publication, publication equals new (SOUND) .…
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