1

What does getApplication mean?

I understand instance of class like Input, Registry, and String.

What about Application? What does it include? Why do we need this class?

1

1 Answer 1

1

According to the Joomla API reference manual getApplication returns the global CMSApplication object, only creating it if it doesn't already exist.

Imagine getApplication calls the guts behind Joomla to be used in all of your other site methods.

As an example:

$app = JFactory::getApplication();

//SAY YOU WANT TO SET A USER STATE VALUE
$app->setUserState('option.mystate','1');

getApplication references all of the other needed functionality for Joomla that allows you to access the core methods of the CMS, in this instance setUserState.

Joomla API Reference for getApplication

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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