Ajith
Ajith

Reputation: 305

Overriding Joomla core component file

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

Upvotes: 10

Views: 4574

Answers (3)

Stergios Zg.
Stergios Zg.

Reputation: 662

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

just adding some simple human reading commands

Upvotes: 0

nibra
nibra

Reputation: 4028

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.

Upvotes: 8

Adam B
Adam B

Reputation: 1158

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

Upvotes: 1

Related Questions