Last Updated: February 25, 2016
·
850
· jeremyrajan

Extending Joomla Functions to external pages

Include the below code at the top of the PHP page.

//define constant
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );


// adjust joomla path according to your joomla installation
define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] . DS . 'joomla' );

//include joomla core files
require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );

//create application
$mainframe =& JFactory::getApplication('site');

//joomla functionality has been included!

//Now we initialize database object
$db = JFactory::getDBO();

//Importing the Plugin Helper
JLoader::import('joomla.plugin.helper');

// test whether some plugins is enabled
$pluginenabled = &JPluginHelper::isEnabled('authentication', 'joomla');