Views across Multisite?

Events happening in the community are now at Drupal community events on www.drupal.org.
joyseeker's picture

From what I find on drupal.org, Views does not work with external databases. I have a multisite setup but do not want to share the content tables, although I do want a View on the top domain across the subdomains' content.

(I have a workaround by manually copying and pasting links to selected subdomains' content in a new content type on the top domain when I want to display a block on the top domain, but I will have to constantly maintain and update it.)

Any thoughts about accessing external databases in Views, whether there will be a way to do this soon (perhaps in D7), or other ways to approach it?

Susan

Comments

You can export the view from

dadamo's picture

You can export the view from the main site and import it into the subdomains, but you would still have to update the info across the subdomains

Maybe you could set it up as a feed from the main domain and set up a feed aggregator in the subdomains. Then format the feed..

Edit: This link may be helpful - http://drupal.org/node/314097

Use a module?

apperceptions's picture
  1. Not sure what you mean by an external database as I can think of several meanings. If you mean that there is no way to connect to the external database host from your host, then you are probably correct about not using Drupal Views. But if you mean that it is external to the Drupal database(s) on your system, then you might still be able to access the external database from within Drupal Views using the table wizard and schema modules.

For example, I can address WordPress database tables on another mySQL server on my network and create an SQL VIEWs in my Drupal database that uses the full network name for the external database tables I need. Then hook them in using the mods (see url's below). Not sure if this works easily across different vendor's SQL server's but the addressing is part of the SQL standard, so maybe.

  1. If you export the view and place the code in a module, then you could share that module across your multisite. You may also want to look into chaos tools suite module to help with this. Changes to these views can be made using update api calls.

http://drupal.org/project/ctools
http://drupal.org/project/schema
http://drupal.org/project/tw

YMMV,
Markus

UPDATE: very strange. I see a "one" in front of first and third paragrahs in safari 5/mac. I though I made a typo. When I edit it shows there is a 'two' in front of the third paragraph. Does anyone else see the two 'ones'? Very odd.

The Markdown input format has

christefano's picture

The Markdown input format has been misbehaving on this site since the beginning (in 2006!). In the future, put a   before list numbers or just select the "Filtered HTML -- No Markdown" input format.

Markdown is as Markdown is.

Garrett Albright's picture

Markdown is as Markdown is. The problem is that it often causes unusual behavior for those who aren't familiar with it. Perhaps the non-Markdown filter should be the default, but those of us who are familiar with it can toggle a switch in our profiles to make the Markdown one default for us…?

Actually, Views 2 can already

Bill Bostick's picture

Actually, Views 2 can already work with external databases. You just have to write the gasket layer using the Views API. Assuming you have Views and Advanced Help installed, see the Views API documentation... specifically, the section titled Describing tables to Views, which has a section describing the database attribute:

If this table is held in a different database from your Drupal database, specify it as a string in the exact same format as the settings.php file. This is a special purpose variable that will probably be only used in site specific code, and it must be the same database type as your Drupal database. Also, don't try to join it to any table that isn't in the same database. That'll just create all kinds of silly errors.

and here's a forum post from someone using this method.

Views API

apperceptions's picture

Cool. I like that approach even better. probably much lighter weight and simpler solution that using all of TW and Schema. Thanks!

Thanks for the ideas

joyseeker's picture

I'll check them out.

Susan

Some fresh thinking on multisite contnet sharing

lappies's picture

I just read this article The Drupal service cloud where Kristoff explain content sharing between multiple sites: The following are interesting remarks:

<

blockquote>
When planning a complex set of interconnected services, you have 3 options:

* A) you can pull in (and locally store) all data and build your "view" on the client side
* B) you can build local queries of remote data sources
* C) you can display processed and (pre)themed information from the remote data sources

Scenario A used to be the default choice: keep the data in one Drupal database and then do some node access magic, classical examples of this technique are Drupal's great “content separation tools”: Organic groups and the Domain access modules.

May be this thread can help:

mxt's picture

May be this thread can help: http://drupal.org/node/576694

shareing views tables from one database?

ñull's picture

http://groups.drupal.org/node/46188#comment-121096

May be this is a pointer in the right direction? May be this way you can share the views tables across the sub domain sites?

best way to share views across multiple site

zeet's picture

hi

i am new to drupal development. i am not sure this is the right place to pop my question.anyway i am building multiple site with drupal and getting a bit confused about what's the best way to share views across the multiple site.have searched around various topics and there are so many ways of doing it now am confused about which is the best way.which must be scalable with out much effort.

i have bit of complication with using domain access as i am using separate settings.php files and separate databases for each sub domain.

can anyone please suggest me....?

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: