1

I've built two custom modules for Joomla ("reservation" and "contact") which are working just fine, however time to time I have to upgrade them. Is it possible to make them to share the same "helper.php" so I could keep code in one place? For example the post function is the same for these two modules. I want the "contact" module to use the "reservation" helper.php post function. Thanks

Jim
  • 2,760
  • 8
  • 42
  • 66

2 Answers2

2

You can simply include the reservation module helper inside the contact module and use it. For example lets say that your modules are mod_reservation and mod_contact, in mod_contact.php you include the reservation helper file and use it like this:

require_once JPATH_SITE.DS."modules".DS."mod_reservation".DS."helper.php";
modReservationHelper::post();
mck89
  • 18,918
  • 16
  • 89
  • 106
1

Or you make a custom helper module,, which is needed in order for the other 2 to work. I dont know for sure but I thought you can check for other modules when installing a module. In that check you check for the helper module and if not present you give a error. You could also say that a certain module needs atleast version X.XX.XX of the helper module and if the version is too long also give an error in during the install of the module.

SynerCoder
  • 12,493
  • 4
  • 47
  • 78