joomla2.5 - how to make $get_db = &JFactory::getDBO(); work in scripts outside joomla 2.5 framework? -


for joomla 1.5 used following code lines database object, whats equivalent code joomla 2.5? used many codes seems not working, including found on stackoverflow itself... want call php script ajax update drop-down through db... , im getting error 500: internal server error

// joomla 1.5 code define( '_jexec', 1 ); define( 'ds', directory_separator ); define( 'jpath_base', $_server[ 'document_root' ] );  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' ); $mainframe =& jfactory::getapplication('site');  $get_db  = &jfactory::getdbo(); 

my script file im calling ajax has following code... still responding internal server error, dont knwo whats wrong includes oor constants, if remove lines except last, works fine , 'hi' returned ajax call... im using joomla 2.5.7, hint ???

  //joomla 2.5 script not working   define( '_jexec'  1 );   define( '_valid_mos'  1 );   define( 'jpath_base'  realpath(dirname(__file__)));   define( 'ds'  directory_separator );   require_once ( jpath_base .ds.'includes'.ds.'defines.php' );   require_once ( jpath_base .ds.'includes'.ds.'framework.php' );   echo jpath_base .ds.'includes'.ds.'framework.php';   $mainframe =& jfactory::getapplication('site');   $mainframe->initialise();   echo $mainframe->getcfg('sitename');   $db =& jfactory::getdbo();     echo "hi"; 

here code using access joomlas database shell-scripts:

define('_jexec', 1); define('ds', directory_separator);  if (!defined('_jdefines')) {     define('jpath_base', dirname(__file__));     require_once jpath_base.'/includes/defines.php'; }  require_once jpath_base.'/includes/framework.php';  // mark afterload in profiler. jdebug ? $_profiler->mark('afterload') : null;  // instantiate application. $app = jfactory::getapplication('site');  // initialise application. $app->initialise();  $dbo = jfactory::getdbo(); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -