joomla 1.7:覆盖模块helper.php
我想准确地覆盖模块的 helper.php
文件
\administrator\modules\mod_quickicon\helper.php
我想要的是更新此文件中的 getButtons 函数,
我必须覆盖此特定文件的选项是什么?可以使用插件吗?
谢谢
I want to override a helper.php
file of a module, exactly
\administrator\modules\mod_quickicon\helper.php
what I want is to update the getButtons function in this file
what are the options I have to override this particular file ? its possible using a plugin ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您实际上只能对 tmpl 文件夹中名为 default.php 的文件进行模板覆盖。如果您想覆盖 helper.php,您实际上是在重写模块本身。这不一定是坏事,只需将现有 helper.php 文件的内容复制到另一个文件中进行备份,然后破解即可。这样做的缺点是,如果有人更新了模块,而您安装了该更新,则必须重新进行黑客攻击。再说一次,解决这个问题并不难。只需备份备份备份即可。
还有一些想法:
您还可以执行以下操作:
1) 将模块复制到另一个文件夹,同样以 mod_ 开头,但名称不同。
2) 修改 xml 文件、帮助程序文件、组件文件(以及任何其他必要的文件)以适应新名称。也可以对 helper.php 做任何你想做的事情。
3) 转到扩展管理器并发现安装这个新模块
4) 转到模块管理器并创建新模块的新实例(使用与旧模块相同的位置)。
5) 取消发布您要替换的模块
这样做可以避免更新丢失。
You can really only do a template override on the file in the tmpl folder called default.php. If you want to override helper.php, you're essentially rewriting the module itself. This isn't necessarily a bad thing, just copy the contents of the existing helper.php file into another file for backup, and hack away. The downside of doing this is that if someone updates the module, and you install that update, you'll have to redo your hack. Again, it's not that hard to work around. Just backup backup backup.
Some more thoughts:
You could also do the following:
1) Copy the module to a different folder, beginning with mod_ as well, but with a different name.
2) Modify the xml file, helper file, component file (and any others that are necessary) to account for the new name. Also do whatever you want to helper.php.
3) Go to extension manager and do a discover install of this new module
4) Go to module manager and make a new instance of the new module (using the same position as the old one).
5) Unpublish the module you're replacing
Doing this will keep you safe from update loss.
这是我用 Joomla 所做的! 3.3.1 但可以用 Joomla! 来完成! 1.7 也是:
复制
default.php
来自至
打开复制的文件并替换下面的行
用这些行:
就是这样。您可以编辑或创建
/administrator/language/overrides/en-GB.override.ini
并添加以下行:享受吧!
Here is what I've done with Joomla! 3.3.1 but it might be done with Joomla! 1.7, too:
Copy
default.php
fromto
Open the copied file and replace the line below
with these lines:
That's it. You can edit or create
/administrator/language/overrides/en-GB.override.ini
and add these lines:Enjoy!