$a = JFactory::getApplication('site');
I came across this in Joomla API:
static JApplication getApplication ([mixed $id = null], [array $config = array()], [string $prefix = 'J'])
What are the examples of $id, $config and $prefix?
$id
can be 'site'
or 'administrator'
. If you don't set it, then if you are on the backend, JFactory::getApplication('administrator')
will be returned and JFactory::getApplication('site')
for the frontend.
Depending on the $id
, either /administrator/includes/application.php
is included or just includes/application.php
.
Using $config
you can set the name of the configuration file, session name sessions etc.
Prefix is class name prefix. All core Joomla classes have been prefixed with J, that's why it is the default setting. For example JAdministrator
.
Have a look also at http://joomlacode.org/gf/project/joomla/scmsvn/?action=browse&path=/development/tags/1.6.x/1.6.3/libraries/joomla/application/application.php&view=markup for __construct
and getInstance
methods of JApplication
for more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With