Modifying native module to work with other tables
I want to modify a native joomla module that display articles of a category. I want it to display articles of an other prefix tables (both joomla website are on the same server).
Notice that I already looked at available extension but none of them would fit.
I tried to modify the helper.php of the native joomla module tables, by changing the
$com_path = but i am getting aFatal error.
Native code: $com_path = JPATH_SITE.'/components/com_content/';
My try : $com_path = '/homez.420/kmxsiksf/rsc/components/com_content/helpers/route.php
To use an external database (even if it's on your server) in Joomla extensions, the proper way would be to set some options before retrieving the JDatabase-object.
Create a helperclass to handle your external db, and in every method that uses the DB-object you simply set the options of your external db before retrieving the object:
$option = array(); $option['driver'] = 'mysql'; $option['host'] = 'localhost'; // In your case probably localhost $option['user'] = 'dbusername'; // User for database authentication $option['password'] = 'badpass12345'; // Password for database authentication $option['database'] = 'bigdatabase'; // Database name $option['prefix'] = 'abc_'; // Database prefix (may be empty) $db = & JDatabase::getInstance( $option );
You are now able to use your external database the same way as you would with your regular db.