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

Valentin Despa
  • 40,712
  • 18
  • 80
  • 106
Ajith
  • 305
  • 1
  • 3
  • 10

3 Answers3

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.

nibra
  • 3,958
  • 2
  • 20
  • 34
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 :)

Adam B
  • 1,140
  • 2
  • 18
  • 30
0

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

just adding some simple human reading commands

Stergios Zg.
  • 652
  • 6
  • 9