</> Developers Guide to Funraisin

The Custom Controller

Often with a site we need to do more than just edit a template, often we will need to build in additional functionality that interacts with the database, sends emails, etc etc and for this type of requirement we have a custom controller.

What is the Custom Controller?

The custom controller is a blank CodeIgnitor controller that sits on the server within the main site controllers but this one is editable and allows you to build in advanced functionality using all the features available within CodeIgnitor.

<?php

class Customcode extends CI_Controller {

}

The controller itself sits in the doc root at https://www.domain.com/customcode so any function you add to it will be available as https://www.domain.com/customcode/myfunction

<?php

class Customcode extends CI_Controller {

    function myfunction(){

    }

Access to the Custom Controller

Editing the custom controller can be done via the built in Developer module within the Funraisin admin. Any edit will be logged and a copy of the original file will be stored in the site's CDN so any errors made can be rolled back to past versions.

Common Uses

The custom controller is one that is commonly used by Funraisin developers to add server side logic to certain elements of a site, but the more common scenarios are.

Cron Updates
Often there is a need to perform automated tasks to data such as calculate badges, or send data to a 3rd party platform that isn't supported naturally.

Ajax Calls
A common use of the custom controller is to store functions which can be called via Ajax from the main site for performing tasks like Autocomplete lookups, custom leaderboards, etc