Example of HostBill Controller PHP File?

Started by jhoffmcd, March 10, 2014, 05:12:00 PM

jhoffmcd

I'm trying to learn how to get my custom plugin for HostBill started. I get the class.customplugin.php part, and the Smarty template system and files. I just don't see how the controllers are supposed to work. The docs kinda suck for this. Usually for this stuff I can reverse engineer and example from another plugin, but they are all IonEncoded so I'm in the dark.   >:(

zero0097

I understand your anger.... Welcome to HostBill (sarcastic).

What do you want to know about them? A controller can be for clients, or for admins, where you put it depends on what you want. For clients you need to create a "user" folder inside your module dir, if you want a controller for admins then you'll need create a folder "admin", in both cases inside that folder create class.yourmodulename_controller.php and define your controller like this:

class MyModuleName_controller extends HBController
{
    /*
        Then you can define some "actions"? an array $request will be passed to that action.
    */
    public function helloWorld($request)
    {
          print_r($request);
          exit();
    }
}


Depending on the controller type, for example if this one was for admin, then you'll execute it like this: youreffinhostbill.com/admin/?cmd=youmodulename&action=helloWorld

Good luck.