Expression Engine Controllers Expression Engine Controllers codeigniter codeigniter

Expression Engine Controllers


Controllers are the heart of your application, as they determine how HTTP requests should be handled.

As you're probably well-aware, a CodeIgniter Controller is simply a class file that is named in a way that can be associated with a URI.

<?php    class Blog extends CI_Controller {        public function index() {            echo 'Hello World!';        }    }?>

The ExpressionEngine equivalent are template groups and templates, and are managed from within the Control Panel's Template Manager.

enter image description here

Since EE's template groups and templates can be named anything you want, the URL structure unsurprisingly loosely mimics a CodeIgniter app — after all, EE is built on CI.

For example, consider this URI: example.com/index.php/blog

  • CodeIgniter would attempt to find a controller named blog.php and load it.
  • ExpressionEngine would attempt to find the template group named blog and load the template named index.

Continuing with this example, the second segment of the URI determines which function in the controller gets called (for CodeIgniter) or which template gets loaded (for ExpressionEngine).

Building off the same URI: example.com/index.php/blog/entry

  • CodeIgniter would attempt to find a controller named blog.php and load it.
  • ExpressionEngine would attempt to find the template group named blog and load the template named entry.

Starting with the third and beyond URL segments is where CodeIgniter and ExpressionEngine start to take different approaches. (A full explanation of their differences is beyond the scope of this answer).

While there are many similarities between CodeIgniter and ExpressionEngine, at a very low-level, CodeIgniter lets you build Web Apps while ExpressionEngine lets you build Web Sites.


I know this is old, but I just thought someone looking at this might find the actual response useful.As others have said, routes for controllers are ignored by default in ExpressionEngine.To change this, you have to edit the first index.php and comment out the routing defaults:

// $routing[‘directory’] = ‘’;// $routing[‘controller’] = ‘ee’;// $routing[‘function’] = ‘index’;

Once that is done, you can add controllers just like @rjb wrote on his response.

<?phpclass Blog extends CI_Controller {    public function index() {        echo 'Hello World!';    }}?>

After this is done, ExpressionEngine will check first for controllers and if none is found, it will look for templates.


Generally-speaking, ExpressionEngine uses template groups and templates to render content.

EE is built on CI, but it doesn't function like CI, as it's a CMS, not an application framework.