Initializing the Joomla! 1.5 Framework in an external script

From Joomla! Documentation

Joomla 1.5

Requests that should be handled by Joomla! should be issued to the index.php file in the main folder of your Joomla! installation. This will ensure that the Joomla! environment is loaded correctly.

In some exceptional cases, it might be necessary to load the Joomla! Framework separately. This is mainly useful when you want the Framework to be loaded from an external script, without launching the Site application. You can use the following code to do so:

/* Initialize Joomla framework */
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
/* Required Files */
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
/* To use Joomla's Database Class */
require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' );
// Your code starts here...
// Remember that the Site application isn't running, so you cannot access $mainframe or any of its methods.