Setting up multiple applications with CodeIgniter
In addition to my previous post where I discussed the initial setup of your application with CI (CodeIgniter), I'll use this post to provide a method of setting up your environment for multiple applications.
Extending the V in MVC – revisited
This post is an revised version of 'Extending the V in MVC on the web' of November 9, 2008.
When I first started working with the MVC method it was with my own framework. After noticing that maintaining my own framework would be very time-comsuming I embarked on the search for a free, fast and widely supported PHP web framework. The one I found that time was 'CodeIgniter'.
After working on different projects I noticed that most websites present the same data to the visitor in several different formats. Think of RSS/Atom for blog posts for use in an RSS reader together with the (x)html versions.
While essentially providing the same data to the visitor the programmer of the website has to put sizable amount of work to add little extra functionality in the form of an RSS feed. Repeating a lod of code for input validation, data retrieval from the database and creating extra routes into the application. As you can imagine this could grow into a tedious job.
I'll be describing techniques known and in use today, but reinvented each time again as a (new) developer starts working on an web application. Here we'll be giving them name and be describing them.
Setting up CodeIgniter – Basics
In this post I'll show how to set up CodeIgniter in a way that your code and configuration (passwords!) are safe. It will involve moving the "system" and "application" outside the (public) document root.
Seperating both `system' and `application' has obvious advantages for maintainance and for reusibility. Using a seperate `www' directory enables you to publish all your application specific JS/CSS and other public files.
Doctrine meets CodeIgniter
Anyone who has made websites in the past has encountered it. The endless bugging typing of SQL queries, always doing the same over and over again. This struggle is lightened by the use of frameworks or even complete CM-Systems. However, SQL query writing is still often needed.
To counter this (and other annoying pestering little details mongering), Object Relational Mappers were invented. Doctrine is a PHP implementation of the RoR ORM. And now it's quite easy to merge CodeIgniter and Doctrine into one package.
Just follow the readme and continue your adventure.
Extending the V in MVC
A revised edition is available. There is now no more need to download the PDF.
Last year I wrote an article about extending some of the ideas in the View section of MVC. I propose to use Partials and to use Lay-outs. Lay-out is perhaps a term that should be better defined. I wrote this article after an implementation in CodeIgniter.
This article introduces the concept of Partials (small views that contain parts and are reusable) and the concept of Lay-outs, used for displaying the same information in different formats.
When I first started working with MVC it was with my own framework. After seeing that it would require to much time to maintain and develop my own framework I started the search for a free, fast and widely supported php web framework. I found this framework and it’s name is ‘CodeIgniter’. You can find it at www.codeigniter.com.