Controller

A controller is called out from router level and that's where we define which controler to call out depending on the path

Path and names of controllers

Controller has to have a name representing structure of an autoloader, that is classes with name "adminMainController", name of the file has to look like this: "adminMainController.class.php". Controllers are in the path or in /app/controller/ or inside of a given plugin that is /app/plugins/OUR_PLUGIN/controller/ Subpaths are also allowed for the controller folder and they are accordingly /do or /ajax. Only from those paths system will download controllers available in our system.

Controller file structure

A controller is coded in object oriented PHP, that's why it inherits after specified classes, it of course doesn't have to inherit, however we're using a certain standard arising from WinduCORE

As we can see our simpleController is extended by htmlController, which adds support of smarty and allows displaying of .tpl files. In our simple controller we've created a grip to $pagesDB table and returned it to the template main.tpl in which we can keep on using our table object.

Extending controller and setting up paths

It is important to define the folder from which system has to download templates. If we're creating our plugin, this folder has to contain templates in plugin structure. In order to define your own paths you have to extend our controller with a transitional controller. You can do it in the same file but it won't good for easy use if the amount of files grows.

To do so, we create a new controller "simpleMainController" and we extend our base one.