OtherDatabase - anybody have experience with this?
I have a project that requires connecting to an external MySQL database to read scheduled events that are developed in a different database than Contao. I stumbled across the OtherDatabase extension in the repository and I think that might work for the connector and to use the event list module to display events from that database.
Does anybody have any experience with this extension who could offer some advice? Documentation on this extension is limited.
Ernest McDermon
Snellville, GA
Re: OtherDatabase - anybody have experience with this?
Hey -
On the same topic: where to paste the instructions (which file):
Quote:
In your code, create a new object:
$myDb = OtherDatabase::getOtherInstance('example');
where example is the key from the configuration array.
Then you use this object just like you would $this->Database, f.e.
$res = $myDb->prepare('SELECT * FROM myTable WHERE ?')->execute($someVar);
while ($res->next())
You may add additional keys to the config array and access them with OtherDatabase::getConfig(),
possibly point to the example of an existing module, e.g. comments module
Re: OtherDatabase - anybody have experience with this?
First, I'd like to point out again that this is just a utility class for extension developers.
If you install it, you can just use it in your code for your own extensions, it doesn't enable Contao to use external databases.
So, if you like to read events from an external database, you'll need to program your own module, or extend Contao's event module.
I wrote an extension catalog_otherDb, which extends the Catalog extension by the possibility to connect to an external database. If it helps I can provide you with the code.
Re: OtherDatabase - anybody have experience with this?
You can also look at an older version of Typolight 2.7 and look for the modules/pun_bridge/ where the backend routines switch databases (between the typolight [contao] and punbb databases). This will not allow you to directly access/edit content remotely, as Contao only supports local access. However if you want to import or access other data you can use this method, like punBB does.
Re: OtherDatabase - anybody have experience with this?
Ok, I'm just trying to understand myself, where it code i can use this instructions. It could use an example, because the description for user is short.
Re: OtherDatabase - anybody have experience with this?
just search google for "typolight 2.7.2 download"
Re: OtherDatabase - anybody have experience with this?