(created: January 22, 2015; last update: January 23, 2015)
Now that we’ve learned the basics regarding CodeIgniter, it’s time to start a tutorial about making our first application, a CMS (Content Management System) or blog, in CodeIgniter.
Our CMS (blog) will be a multilanguage one.
Also, in order to work fast, we will use an established css framework for the admin area. I will use Bootstrap.
We will start by creating an admin area and then we will look into creating the front area.
First of all, make sure you download the latest version of CodeIgniter (version 3). Why do I say this? Because starting with the second half of January 2015 the new session library was introduced, thanks to the great work of CI community and herculean effort of Andrey Andreev.
After installing CodeIgniter, make sure you follow Learn CodeIgniter 3 in small steps from step 1 to step 6. Also, it will be a good idea to install Composer for our application. You can see a tutorial in step 7. Just don’t install any packages yet.
Create a configuration file specific to our CMS
We have a configuration file named config.php, but this is for the application… I mean, for the CMS. But what if we want to use the same CMS for another site? That means, another title for the CMS, another administrator, etc.
So why not create our own configuration file. Let’ create a file named “cms_settings.php” inside application/config/development directory and put in the file whatever comes to our minds:
$config['cms_title'] = 'CI App'; $config['cms_dev'] = 'firstname.lastname@example.org';
For now, we only set a title for our CMS, and an email address for the developer of the site.
Now we go in our “autoload.php” file and make sure we load the configuration we’ve just created:
$autoload['config'] = array('cms_settings');
Simple, isn’t it?