Overriding Joomla core component file
Asked Answered
S

3

10

I am trying to override the com_content/views/article/view.html.php file in joomla using the instructions given in this page

It says I have to create a folder named 'code' in base directory and create the same directory structure. I tried it , but its not working. Can someone confirm whether its working.

Where should I create code folder? Is it on root of joomla installations?

PS- The edit is working correctly when applied on core file

Scalage answered 7/12, 2012 at 12:56 Comment(3)
Have you tried doing the templating method as well?Adkison
Templating method also not working. I think templating method can only override default.php files inside tmpl folder.Scalage
What version of Joomla are you using?Lyndes
B
8

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.

Barbie answered 28/3, 2013 at 15:37 Comment(1)
Awesomesauce. Nice answerHeartthrob
H
1

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 :)

Hypoderm answered 25/2, 2013 at 23:8 Comment(0)
H
0

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

just adding some simple human reading commands

Hexapartite answered 15/1, 2014 at 13:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.