Get Joomla Library Anywhere In External PHP Pages

Just include the following files given below to get joomla libraries anywhere in external php pages.

define( ‘_JEXEC’, 1 );
define( ‘JPATH_BASE’,realpath(dirname(__FILE__).’/../../../../../..’) );
// we can use 2nd parameter like ‘../../’
define( ‘DS’, DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.’includes’.DS.’defines.php’ );
require_once ( JPATH_BASE .DS.’includes’.DS.’framework.php’ );

//require_once ( JPATH_BASE_NEW .DS.’includes’.DS.’defines.php’ );
//require_once ( JPATH_BASE_NEW .DS.’includes’.DS.’framework.php’ );

$mainframe =& JFactory::getApplication(‘site’);
$mainframe->initialise();

$db = JFactory::getDbo();

Leave a comment

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.