We often get asked whether Drupal can show information from other websites.
In particular, people want to pull information and display it through Views.
The Views Database Connector module makes this relatively easy. Let’s show you how it’s done.
First, install Views Database Connector from Drupal.org.
Second, go to your sites/default/settings.php file. You will need to edit this file to include the connection information for the new database. The settings.php file already contains information for your current Drupal site. You need to add a second array to include the new database login details. Here’s how the code will look:
- Clear the cache on your site to make sure the new settings.php file is being used.
- Go to Structure > Views > Add new view.
- Under the “Show” dropdown, you’ll now see all the available tables from your other database:
From this point on, you can use Views to show external data, in exactly the same way as you show Drupal data.