4

I want to override a controller inside a component

ie;

File path : components/com_test/controllers/test.php

how can I override test.php ?

3

Overwrite a controller is something that I don´t dare to do, even it is possible.

I recommend you try to use another approach

Option 1 – Modifying the controller to add an event trigger and ask the developer to include it in the next version.

As explained here:

https://techjoomla.com/joomla-development/adding-plugin-triggers-in-your-extensions-how-a-why.html

Ok, you´ll need to hack a core file of the component and of course this change will be lost when upgrading, but if you need it, is likely that is it good for other too, so the developer can be willing to insert that event trigger.

Option 2 – Create a small component to handle your stuff.

As you can easily overwrite the templates of com_test, you can change the call to your own controller /com_mytest.php

Then in there, you can do whatever you need and return control to com_test when ready.

2

It is a complex solution. This plugin should help: Plugin to override 3rd Component controllers, models and views and Modules.

Also you can read about overrides in Joomla docs: How to override the component mvc from the Joomla! core

  • Thanks,but it causes my whole site getting down when i enable plugin – vignesh.D Feb 16 '15 at 9:49
  • Well I can not advice anything more here - I am not a developer of this extension. – Dmitry Rekun Feb 16 '15 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.