Overriding Joomla core component file

亡梦爱人 提交于 2019-11-29 04:13:48

You can override (nearly) any class in Joomla, if your class with the same name is loaded first. To ensure that, you need to create a system plugin.

Here is an example for root/components/com_content/views/article/view.html.php:

class plgSystemOverride extends JPlugin
{
    public function onAfterRoute()
    {
        JLoader::register('ContentViewArticle', 'path/to/override.php', true);
    } 
}

CAVEAT: Overriding a core class can lead to problems with other extensions, if you're not very careful. For views, though, any interferrence with other extensions is less likely.

You can't override component controllers, models and views in core Joomla! without using a 3rd party plugin.

The plugin you need can be found here: http://extensions.joomla.org/extensions/style-a-design/templating/15611

The code folder then goes into your Joomla root unless you're overriding a back-end view in which case it goes into /administrator

Hope this helps :)

You can use the Class Overrider Plugin http://extensions.joomla.org/extensions/tools/development-tools/23994

just adding some simple human reading commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!