expController is the basic Controller class.  It is the parent controller class for all modules in Exponent since it contains all the methods, properties, and helper functions to quickly get a module up and running.  Since each module MUST have some unique qualities to distringuish it from other modules, the expController can NOT be instantiated because it is an 'abstract' class.

Though this is not intended as an API reference, we'll attempt to describe much of expController's work here.

In many ways, there is very little needed in the module's controller since it 1) inherits everything from expController and 2) makes assumptions about the model/data based on the controller name.  

The simplest usable controller code would be the following saved in a module's 'controllers' folder as 'genericController.php'.  There can only be one controller in the system with a given name and it must not duplicate any other class name in the system nor PHP.

class genericController extends expController {
    public $useractions = array(
        'showall'=>'Display Generic'
    static function displayname() { return gt("Generic"); }
    static function description() { return gt("Does generic things to generic data"); }

This provides enough information to get things up and running (provided we also create a 'generic' model file).  The default model is expRecord.  In fact, we've given it an optional name and description so it doesn't pick up the expController name/description which tends to confuse things.  Furthermore, we've make this a 'selectable' module by giving it an optional public 'user action' so it can be activated and added as content.

From here on, we'd add to, override, or enhance expController methods in our generic controller to deviate from the standard expController behavior.

Loading Help