Actions

API15

Difference between revisions of "JFactory Class"

From Joomla! Documentation

Line 1: Line 1:
I'm a newbie to creating extensions and really wish some info was here, so I'll take a stab at adding what I figure out in hopes of helping others.
+
== Examples ==
 +
Access JFactory:
 +
    $var =& JFactory::content();
  
Access the JFactory using the php code:
+
Access an open database via JFactory:
     $var = &JFactory::content();
+
     $database =& JFactory::getDBO();
  
Here are a few lines that are included in examples.  They should each be explained.
+
Access a document:
 +
    $document =& JFactory::getDocument();
  
    $database = &JFactory::getDBO();
 
    $document = &JFactory::getDocument();
 
  
     $uri = & JFactory::getURI();     
+
     $uri =& JFactory::getURI();     
     $id = $row->id;
+
      
 
+
The following provides access to the logged-in user info.
The following provides access to the logged-in user info. Read more here... [[Accessing_the_current_user_object]]
+
 
     $user =& JFactory::getUser();
 
     $user =& JFactory::getUser();
 +
 +
== See Also ==
 +
* [http://api.joomla.org/Joomla-Framework/JFactory.html JFactory class documentation from the Joomla! API]
 +
* [[Accessing_the_current_user_object]]
 +
 +
[[Category:Development]]

Revision as of 07:29, 4 September 2008

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.

Examples

Access JFactory:

    $var =& JFactory::content();

Access an open database via JFactory:

    $database =& JFactory::getDBO();

Access a document:

    $document =& JFactory::getDocument();


    $uri =& JFactory::getURI();     
    

The following provides access to the logged-in user info.

    $user =& JFactory::getUser();

See Also