1

This is connected to the earlier post I mentioned:

com_content task not on the controller's method?

Now that I found the loadhistory function, I was wondering, how was it able to be called directly from the URL below:

/BDES3/administrator/index.php?option=com_content&task=article.loadhistory&version_id=1

in the part : &task=article.loadhistory

article is the controller right? and loadhistory is the controller function?

Based from this link, https://docs.joomla.org/Absolute_Basics_of_How_a_Component_Functions

is a statement saying :

"If your request contained a 'task=jump' parameter the controller would have tried to call a method (function) named 'jump' in your controller class"

But when i viewed the article class under the controllers folder, there was no loadhistory function. It was found in the JModelLegacy Class.

How is this possible? I am planning on re-using the loadhistory functionality on a custom component that we're trying to build.

2

in the part : &task=article.loadhistory article is the controller right? and loadhistory is the controller function?

Yes you are right. The first part it the controller name and the second part is the method name.

But when i viewed the article class under the controllers folder, there was no loadhistory function. It was found in the JModelLegacy Class.

That is because it is located in the parent JControllerForm class.

You will find these doc useful regarding controllers: JController and its subclass usage overview

  • Thank you very much sir. Just one question, will I able to re-use this in a custom component? – Break the Law Jan 23 '15 at 8:04
  • 1
    Do you mean to re-use the same method? Yes if your class will inherit from JControllerForm. Otherwise you will need to make your own method (of course you can just copy the existing and modify for your needs). – Dmitry Rekun Jan 23 '15 at 10:09

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.