|
If your Ajax perform a standard joomla initialization, the table prefix can be retreive from the $table_prefix = JFactory->getConfig( "config.dbprefix"); or from the $DB connection.
If you do not perform a standard Joomla initialisation, you have to add it.
See the Joomla "index.php" file to get inspired of the initialisation.
The code depends on your joomla version (1.5 or 2.5).
In 2.5, the correct joomla initialization is
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
You just have to change the path of the "site file" by the correct number of dirname( dirname( ....dirname( __FILE__))) to retreive the root directory of the site.
|