custom module to display content (nodes and fields) from another database

Mason: 5 days ago

we are trying to somehow show fields from nodes existing in a different drupal database than the default. Eg. in the site the module is installed (drupal2) we have the following settings.php

$databases = array ( 'drupal1db' => array ( 'default' => array ( 'database' => 'drupal1db', .... 'default' => array ( 'default' => array ( 'database' => 'drupal2db', ...

is there a way to override views so that it displays content with specific type "eg news" from the drupal1db and/or from both the databases?

Thank you

Violet: 5 days ago

Absolutely you can use a different db for a view. First create a custom module use hook_views_data() ( in a file to define the fields of the external db. Once you have defined the fields and cleared the cache you will be able to select a different base table for your view.

With some custom coding and db_set_active() or views relationships you should be able to use both.

EDIT: Assuming Drupal 7.