Get instance of sub controller

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
BloodBaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Fri Dec 08, 2006 9:13 am

Get instance of sub controller

Post by BloodBaz » Fri Nov 21, 2014 11:47 am

Under certain conditions, I wish to immediately call a task in a sub-controller of my component from the base class. However, if I use the following code

Code: Select all

$controller	= JController::getInstance('Rsdisclaimers');
it returns my component's master controller or sub-controller purely based on the task parameter from the request POST/GET. I wish to call the "agree" task in my sub-controller (called "Rsdisclaimer" note: singular) and although this works fine if I POST the task "rsdisclaimer.agree" I need to get the sub-controller and execute the "agree" task even when that is not what the task parameter in the request object is set to.

How do I get my sub-controller instance?

Thanks.

jcms
I've been banned!
Posts: 2233
Joined: Wed Nov 19, 2014 9:23 am

Re: Get instance of sub controller

Post by jcms » Fri Nov 21, 2014 6:36 pm

maybe not clear on this question.
After extend a component, you want to use sub function or build sub controller with old function?

BloodBaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Fri Dec 08, 2006 9:13 am

Re: Get instance of sub controller

Post by BloodBaz » Mon Nov 24, 2014 12:31 am

jcms wrote:maybe not clear on this question.
After extend a component, you want to use sub function or build sub controller with old function?
Hi jcms,
Can you clarify what you mean by "extend a component". The master component and sub component are two separate classes. The master component is called "controller.php" in the root of the component. The sub-component that has the method I need to called is in "controllers/rsdisclaimer.php"


Locked

Return to “Joomla! 2.5 Coding”