Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Extra database connection information
https://www.tinywebgallery.com/forum/viewtopic.php?f=13&t=3035
Page 1 of 1

Author:  tcarr170 [ 17. Jun 2011, 14:57 ]
Post subject:  Extra database connection information

Hi Michael,

I have copied the database connection info from your "Database Plugin" into my new plugin I wrote. Since I know I will always been in Joomla v.1.5 or higher for this site, is it ok to delete some of the connection options in the If/Else statements. It would save some space in my code.

For example, can I just have this:

$joomla_config = dirname(__FILE__) . "/../../../../configuration.php";
include_once $joomla_config;
$jConfig = new JConfig();
$db_host = $jConfig->host;
$db_user = $jConfig->user;
$db_password = $jConfig->password;
$db_dbname = $jConfig->db;
$db_table = $jConfig->dbprefix . 'my_table';

instead of all of this ...

Current database connection info:

// if you use this in joomla 1.5 the values from joomla are used.
$joomla_config = dirname(__FILE__) . "/../../../../configuration.php";
if (file_exists($joomla_config)) {
include_once $joomla_config;
// we check if joomla 1.5.x or 1.0.x
if (class_exists("JConfig")) { // 1.5.x
$jConfig = new JConfig();
$db_host = $jConfig->host;
$db_user = $jConfig->user;
$db_password = $jConfig->password;
$db_dbname = $jConfig->db;
$db_table = $jConfig->dbprefix . 'joomla_flash_uploader_log';
} else { //1.0.x
$db_host = $mosConfig_host;
$db_user = $mosConfig_user;
$db_password = $mosConfig_password;
$db_dbname = $mosConfig_db;
$db_table = $mosConfig_dbprefix . 'joomla_flash_uploader_log';
}
} else {
// enter your db values below!
$db_host = 'localhost';
$db_user = 'root';
$db_password = '';
$db_dbname = 'joomla15';
$db_table = 'joomla_flash_uploader_log';
}

Thanks,
Tracy

Joomla 1.6.3
JFU 2.14
Server: localhost / development site

Author:  TinyWebGallery [ 17. Jun 2011, 15:11 ]
Post subject:  Re: Extra database connection information

Sure.

- Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/