0

I have 2 websites set on the same drupal 7.32 instance. There are completely different, with different databases. But I need to show some content from website1 in website2.

I just need to get a list of nodes from the database for website1 with one specific type and list some details about them in website2.

I know I can get all the nodes with a certain type like this:

$nodes = node_load_multiple(array(), array('type' => 'node_type_here'));

But this (obviously) works within the same site.

Any tips on how I can get them on a different site?

  • 1
    Are you trying to set up some kind of synchronisation? Or read other site's database directly (I wouldn't)? Some kind of live feed? – Mołot Nov 25 '14 at 15:05
  • @Mołot. No syncronization. I'm just trying to list some entities from website 1 in website 2. I guess you can say it is similar to a live feed. – Marius Nov 25 '14 at 15:07
  • Since it's two completly different websites I think it should be done with Migrate module drupal.org/project/migrate or using xmlrpc.php (more here: goo.gl/DEcQJx - chapter 20). – David Nov 25 '14 at 16:41
  • How often will this occur: Just once, weekly, yearly, whenever a refresh is needed? – Rick Nov 25 '14 at 17:00
  • I have no idea how often the data will change. For sure it won't be daily. But that's all I know. – Marius Nov 25 '14 at 21:10
1

If you are trying to share content between sites, you may want to look at the deploy module....

The Deploy module is designed to allow users to easily stage content from one Drupal site to another. Deploy automatically manages dependencies between entities (like node references). It is designed to have a rich API which can be easily extended to be used in a variety of content staging situations.

To share a Content Type between sites, look into features:

The features module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

Features provides a UI and API for taking different site building components from modules with exportables and bundling them together in a single feature module. A feature module is like any other Drupal module except that it declares its components (e.g. views, contexts, CCK fields, etc.) in its .info file so that it can be checked, updated, or reverted programmatically.

Alternatively if you're only trying to share a list of things, what about using RSS feeds from Website 1 and using the Feeds Module to pull it into Website 2?

Import or aggregate data as nodes, users, taxonomy terms or simple database records.

One-off imports and periodic aggregation of content Import or aggregate RSS/Atom feeds Import or aggregate CSV files Import or aggregate OPML files PubSubHubbub support Create nodes, users, taxonomy terms or simple database records from import Extensible to import any other kind of content Granular mapping of input elements to Drupal content elements Exportable configurations Batched import for large files

Also as mentioned in the comments the Migrate Module is worth a look.

The migrate module provides a flexible framework for migrating content into Drupal from other sources (e.g., when converting a web site from another CMS to Drupal). Out-of-the-box, support for creating core Drupal objects such as nodes, users, files, terms, and comments are included - it can easily be extended for migrating other kinds of content. Content is imported and rolled back using a bundled web interface (Migrate UI module) or included Drush commands (strongly recommended).

  • I was hoping of an out of the box way to do it. Will take the feed approach. Seams the less intrusive one. Thanks. – Marius Nov 25 '14 at 21:09
  • For a good jump start, look into the YouTube video youtube.com/watch?v=9wasIAbfRls – Rick Nov 25 '14 at 21:39
  • Thanks for the video link. it certainly gets the ball rolling for a drupal noob (like myself). – Marius Nov 26 '14 at 8:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.