Load Joomla! API externally

// BEGIN: Load Joomla API externally require_once('../../configuration.php'); $ytconf = new JConfig; $host = $ytconf->host; $user = $ytconf->user; $password = $ytconf->password; $offset = $ytconf->offset; define( '_JEXEC', 1 ); define( 'DS', DIRECTORY_SEPARATOR ); define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..' )); $root = pathinfo($_SERVER['SCRIPT_FILENAME']); define ('BASE_FOLDER', basename($root['dirname'])); define ('SITE_ROOT', realpath(dirname(__FILE__))); 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' ); require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'filter' . DS . 'output.php' ); // filteroutput.php in j25, output.php in j3 jimport('joomla.filter.output'); $mainframe = JFactory::getApplication('site'); $mainframe->initialise(); // database access details $conf = new JConfig; $db_username = $conf->user; $db_password = $conf->password; $db_name = $conf->db; $db_prefix = $conf->dbprefix; // END: Load Joomla API externally // if [[ echo JURI::base(); ]] is printed properly, means that the joomla api has been loaded successfully :)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.