| Drupal
Drupal Views Database Connector
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:

Views Database Connector and settings.php
  • 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:
Views Database Connector and the Views module

From this point on, you can use Views to show external data, in exactly the same way as you show Drupal data.


About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.