Thursday, 11 March 2010 23:04

If you've ever had the need to load the Joomla! framework inside an external, non-Joomla! PHP script (say, when using Jumi), you can use this handy script to load the necessary files to allow you to use Joomla! classes in your PHP script.

define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
// JPATH_BASE should point to Joomla!'s root directory
define( 'JPATH_BASE', realpath(dirname(__FILE__) .'/' ) );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$user =& JFactory::getUser();
$session =& JFactory::getSession();
Comments (1)
1 Thursday, 29 April 2010 07:56
Hi there, I see you have a few changes from the article at!_Framework

For example, is there a particular reason why you changed the JPATH_BASE definition?

That article also has the command to use J! without a DB:

/* Create the Application */
$mainframe =& JFactory::getApplication('appname', array('session' => false));

Add your comment

Your name:
  The word for verification. Lowercase letters only with no spaces.
Word verification:

The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.

Joomla Extensions