Create a CMS using CodeIgniter 3

(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'] = 'youremail@yourdomain.com';

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?

20 comments

  1. I like your blog. thanks for the tutorial I learned a lot in codeigniter. You made my day more productive to my job.

  2. just a comment for newbies in this, add
    <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
    to custom config, at least I need or get a php error, and take care in qoutes in the title
    config->item(‘cms_title’);?>
    Great tutorial!! thanks!

  3. Hi guys.
    i have downloaded the app. I created the database and import the tables. I dont know how to run the app.
    localhost/CMS/admin still didnt work. how can i fix it?

  4. maybe for a week i’ll be in your blog, to learning.. 🙂
    i’m very love coding, i’m appreciate it of this all.. for other visitor, don’t try some shortcut with just download done project. Just read and follow step by step in article, if you done with small project than challenge’s yourself to make lite modification on coding (at mean adding your own plugin or Etc). That would be great from nothing to something.. 🙂

    i’m newbie too.. 🙂

  5. Thank for great tutorial 🙂

    But I have one question… Are you going to add some chapters about front-end of the cms?

    Sorry for my bad English 🙂

    1. Hello. I am glad you liked it, but no… As long as you have the MY_Controller I made and the Findcontent controller, all should go easy from there on….

  6. Hi avenir,
    I like your tutorial.
    “Well… I’m out of ideas on what to write about. Do you have any ideas? Please, write me in any comment section you find, and I will do my best to tell you about that particular subject”
    Would you in the future make tutorial about laravel framework with ajax?
    That’d be great i guess.
    But anyway this tutorial is awesome and you save a lot of time..
    so thank you..

Leave a Reply

Your email address will not be published. Required fields are marked *

No spam? * Time limit is exhausted. Please reload CAPTCHA.