简体   繁体   English

Joomla组件替代

[英]Joomla Component Override

By default Joomla has a components/com_users component. 默认情况下,Joomla具有一个components/com_users组件。 Basically, I want to have new user component without editing the existing one. 基本上,我希望拥有新的用户组件而不编辑现有组件。

I want to add new functions/edit existing functions. 我想添加新功能/编辑现有功能。

How can I do this? 我怎样才能做到这一点?

Right now, I just edited the files in the com_users folder but I am sure that's the right approach. 现在,我只是编辑了com_users文件夹中的文件,但是我确信这是正确的方法。

You can modify the look of com_user pages by overwriting views templates in folder: templates/{your template}/html/com_user. 您可以通过覆盖以下文件夹中的视图模板来修改com_user页面的外观:模板/ {您的模板} / html / com_user。 You can do this without any problems. 您可以做到这一点而没有任何问题。

But if you are modifying controllers/models/views code than you must be aware that when you will update Joomla then your changes could be overwritten by updated files. 但是,如果您要修改控制器/模型/视图代码,则必须意识到,当您将更新Joomla时,所做的更改可能会被更新的文件覆盖。 So you can stop updating Joomla on your site (not good idea) or on every update check if your modifications wasn't overwritten and if yes add them again (also not good idea because you will do the same work many times). 因此,您可以停止在您的网站上停止Joomla的更新(这不是一个好主意),或者在每次更新时停止检查您的修改是否被覆盖,如果可以,请再次添加它们(也不是一个好主意,因为您将多次执行相同的工作)。

So, in my opinion, if you must change code of com_user controllers/models/views then write your own component (you can use code from com_user in your new component for start). 因此,我认为,如果必须更改com_user控制器/模型/视图的代码,然后编写自己的组件(可以在新组件中使用com_user中的代码作为开始)。

Use a plugin, is easy. 使用插件,很容易。

Profile plugin is a new extension in Joomla! 个人资料插件是Joomla中的新扩展! 2.5. 2.5。 It allows the addition of supplemental fields in the registration and profile forms of the com_user front end and in the user create/edit form in the back end. 它允许在com_user前端的注册和配置文件表单以及后端的用户create / edit表单中添加补充字段。

https://docs.joomla.org/Creating_a_profile_plugin https://docs.joomla.org/Creating_a_profile_plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM