v1.2.2 - Official User Guide


Dispatchers are classes that performs many operation before the rendering process. They are tipically fired by the controllers. As example, the Website controller fires many of the dispatchers described below.

The Bancha core dispatcher are located inside the core/dispatchers directory.

Instead, the folder for the dispatchers of your application (if you need to create a new one), is application/dispatchers. To add a new dispatcher, create a new file in that directory using dispatcher_name.php as filename and Dispatcher_name as class name.

You can find a sample dispatcher here: application/dispathcers/dispatcher_example.php

You can load a dispatcher using the following function:


//Then, use it as an object of the super-object

//You can specify the name as second optional parameter
$this->load->dispatcher('name', 'foo');

Default dispatcher

This is the default dispatcher of the website: is responsable of allocating the current page, the optional record/records and loading the rendering process. Called from the router action of the Website controller:


Image dispatcher

This dispatcher handles the Image presets. When a preset cached file does not exists, an action on the website controller will be called and that action then fires the image dispatcher. This, will performs all the graphical preset operations and after saving the file on the disk (to cache the next request) will output the content to the client. Called from the image_router action of the Website controller:


$data = array(
    'type'      => 'Products',
    'field'     => 'first_image',
    'id'        => 123,
    'preset'    => 'little-square',
    'filename'  => 'path/to/original.jpg',
    'ext'       => 'jpg'


Read more about the Image presets.

Resources dispatcher

This dispatcher can minify css and javascript resources. It will be automatically used when using the minify function of the Frontend helper. That function generates a URL that will be routed to the resources dispatcher and the requested resources will be compressed, merged, cached and then sent to the client. Called from the minify action of the Website controller:

$resources = array('path/js/jquery.js', 'path/js/application.js');

$this->dispatcher->minify('themename', $resources, 1);

Bancha - Copyright 2011-2012(C) Squallstar Studio -