Joomla两个模块使用相同的helper.php [英] Joomla two module using same helper.php

查看:85
本文介绍了Joomla两个模块使用相同的helper.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Joomla构建了两个自定义模块(预订"和联系"),它们工作正常,但是我不得不不时地对其进行升级. 是否可以让他们共享相同的"helper.php",这样我可以将代码放在一个地方?例如,这两个模块的 post 函数是相同的.我希望联系"模块使用预订" helper.php发布功能. 谢谢

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

推荐答案

您可以简单地将保留模块帮助程序包含在contact模块中并使用它. 例如,假设您的模块是mod_reservation和mod_contact,则在mod_contact.php中,您可以包含预留帮助文件,并按以下方式使用它:

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();

这篇关于Joomla两个模块使用相同的helper.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆