Beside my MODX Revo
2.2.14-pl (traditional) installation is a phpBB-Forum installed. Now I need some information from the phpbb database within modx.
What I have is
class dbInfo
{
public $strDbLocation = 'mysql:dbname=mydatabase;host=127.0.0.1';
public $strDbUser = 'username';
public $strDbPassword = 'passwd';
}
try
{
$dbInfo = new dbInfo();
$objDb = new PDO($dbInfo->strDbLocation, $dbInfo->strDbUser, $dbInfo->strDbPassword);
}
catch (PDOException $e)
{
echo $e->getMessage();
}
[...]
Works great, but I would like to have the class dbInfo within a seperat Snippet from what I can call the database, username and password.
I think it's not a good idea to have the logininformation spread all over my snippets.