Actions

API15

Difference between revisions of "JFactory Class"

From Joomla! Documentation

(Added method list)
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
== Examples ==
+
[[JFactory]]
Access [[JFactory]]:
+
    $var =& JFactory::content();
+
  
Access an open database via [[JFactory]]:
+
''JFactory'' provides access to a group of core Joomla Objects. In each case it returns an object, usually with the current site settings.
    $database =& JFactory::getDBO();
+
  
Access a document using [[JFactory]]:
+
==getApplication()==
    $document =& JFactory::getDocument();
+
  
    $uri =& JFactory::getURI();    
+
Returns a reference to the Global [[JApplication]] object
   
+
<source lang='php'>$app =& JFactory::getApplication();</source>
The following provides access to the logged-in user info.
+
 
    $user =& JFactory::getUser();
+
==getCache()==
 +
 
 +
Returns a reference to the Global [[JCache]] object
 +
<source lang='php'>$cache =& JFactory::getCache();</source>
 +
 
 +
==getConfig()==
 +
 
 +
Returns a reference to the Global [[JConfig]] object
 +
<source lang='php'>$config =& JFactory::getConfig();</source>
 +
 
 +
==getDate()==
 +
 
 +
Returns a reference to the Global [[JDate]] object
 +
<source lang='php'>$date =& JFactory::getDate();</source>
 +
 
 +
==getDBO()==
 +
 
 +
Returns a reference to the Global [[JDatabase]] object
 +
<source lang='php'>$db =& JFactory::getDBO();</source>
 +
 
 +
==getDocument()==
 +
 
 +
Returns a reference to the Global [[JDocument]] object
 +
<source lang='php'>$doc =& JFactory::getDocument();</source>
 +
 
 +
==getEditor()==
 +
 
 +
Returns a reference to the Global [[JEDitor]] object
 +
<source lang='php'>$editor =& JFactory::getEditor();</source>
 +
 
 +
==getLanguage()==
 +
 
 +
Returns a reference to the Global [[JLanguage]] object
 +
<source lang='php'>$lang =& JFactory::getLanguage();</source>
 +
 
 +
==getMailer()==
 +
 
 +
Returns a reference to the Global [[JMailer]] object
 +
<source lang='php'>$mailer =& JFactory::getMailer();</source>
 +
 
 +
==getSession()==
 +
 
 +
Returns a reference to the Global [[JSession]] object
 +
<source lang='php'>$session =& JFactory::getSession();</source>
 +
 
 +
==getTemplate()==
 +
 
 +
Returns a reference to the Global [[JTemplate]] object
 +
<source lang='php'>$template =& JFactory::getTemplate();</source>
 +
 
 +
==getURI()==
 +
 
 +
Returns a reference to the Global [[JURI]] object
 +
<source lang='php'>$uri =& JFactory::getURI();</source>
 +
 
 +
==getUser()==
 +
 
 +
Returns a reference to the Global [[JUser]] object
 +
<source lang='php'>$user =& JFactory::getUser();</source>
 +
 
 +
==getXMLParser()==
 +
 
 +
Returns a reference to the Global [[JXMLParser]] object
 +
<source lang='php'>$xmlp =& JFactory::getXMLParser();</source>
 +
Takes parameters: $type & $options
 +
$type can take the values 'DOM' (default), 'RSS', or 'Simple'
 +
$options takes an options array (default is empty)
 +
boolean ['lite'] for use with DOM to use domit_lite (default)
 +
string [#rssUrl'] for use with 'RSS'
 +
string [cache_time'] feed cache time for 'RSS' (default = 3600 seconds)
  
 
== See Also ==
 
== See Also ==
* [http://api.joomla.org/Joomla-Framework/JFactory.html [[JFactory]] class documentation from the Joomla! API]
+
* [http://api.joomla.org/Joomla-Framework/JFactory.html JFactory class documentation from the Joomla! API]
* [[Accessing_the_current_user_object]]
+
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 05:31, 11 April 2009

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

JFactory

JFactory provides access to a group of core Joomla Objects. In each case it returns an object, usually with the current site settings.

Contents

getApplication()

Returns a reference to the Global JApplication object

$app =& JFactory::getApplication();

getCache()

Returns a reference to the Global JCache object

$cache =& JFactory::getCache();

getConfig()

Returns a reference to the Global JConfig object

$config =& JFactory::getConfig();

getDate()

Returns a reference to the Global JDate object

$date =& JFactory::getDate();

getDBO()

Returns a reference to the Global JDatabase object

$db =& JFactory::getDBO();

getDocument()

Returns a reference to the Global JDocument object

$doc =& JFactory::getDocument();

getEditor()

Returns a reference to the Global JEDitor object

$editor =& JFactory::getEditor();

getLanguage()

Returns a reference to the Global JLanguage object

$lang =& JFactory::getLanguage();

getMailer()

Returns a reference to the Global JMailer object

$mailer =& JFactory::getMailer();

getSession()

Returns a reference to the Global JSession object

$session =& JFactory::getSession();

getTemplate()

Returns a reference to the Global JTemplate object

$template =& JFactory::getTemplate();

getURI()

Returns a reference to the Global JURI object

$uri =& JFactory::getURI();

getUser()

Returns a reference to the Global JUser object

$user =& JFactory::getUser();

getXMLParser()

Returns a reference to the Global JXMLParser object

$xmlp =& JFactory::getXMLParser();

Takes parameters: $type & $options $type can take the values 'DOM' (default), 'RSS', or 'Simple' $options takes an options array (default is empty) boolean ['lite'] for use with DOM to use domit_lite (default) string [#rssUrl'] for use with 'RSS' string [cache_time'] feed cache time for 'RSS' (default = 3600 seconds)

See Also