When you use a PHP framework like Codeigniter to speed up web development, it is a good idea to beware of its strengths and weaknesses.
By default, Codeigniter is setup to run a single application. Since each controller can reference views located in organized, separate folders, an entire website could look like it uses multiple applications. For example, a controller called blog.php could access view files in the views/blog folder. With a single application that requires one database this could work just fine.
Codeigniter comes with all sorts of classes to make a custom blog. Once a blog is built with appropriate styling, there could come a time when the view file needs altering in order to display the blog title in the page title(for order and SEO). (more…)
Codeigniter applications can be integrated into various content management systems; such as WordPress, Joomla and Expression Engine. (more…)
When it comes to building websites with various forms of content, the road often leads to 3 choices;
- Pure PHP/mySQL
- PHP Framework
- Content Management System
Although each method would have its own strengths and weaknesses, the PHP framework is a great place to build, build and build. Since each controller will actually be the name of each web page, it makes it nice and convenient to build reusable pages which are easy to find and edit. For example, you build a contact form with specific validation. Then, you reuse it later but the client wants different validation and fields. The changes would be very simple to change update and even transfer to another Codeigniter installation.
Furthermore, it uses the MVC approach to display web pages.
How does MVC work? The (C) is the controller and is the workhorse.
If a database is used, the controller does a short call to the model.
To get the code from the model into the controller,
Then, the controller sends data to the view. Now, the view returns data back to the controller that sends the desired data to the browser.
If a framework like Codeigniter is used, the model can be bypassed and the database can be accessed from the controller. However, using models just to access a database or xml file, controllers to load and organize the page to the brower and the view for HTML/CSS makes it simple to separate php, database access and style.
To access the database,
$query = $this->db->query(‘SELECT, UPDATE query goes here’);
With a framework like Codeigniter, there is not too many limitationss since a controller can call a view file which accesses a database, makes a database queries and contains html source code. In this case, using a view is almost like using pure php; except the controller is the page name.