Community & Support

Several sites with one database?

I installed Drupal as a test and I am impressed so far about the amazing easy start. Extremely great job done!

Someone pointed me to Drupal as he said, it could solve my problem, but until know I did not find a posting, documentation or any hint about my problem, so I hope you can point me to some articles about this:

I want to run several sites with one database. For an example lets say a car (mycar.com) and a hobby (myhobby.com) site.
I want to run both projects with one database.
Each site should have a different layout.
The car site should display only car articles, the hobby site should display both car and other articles.

My questions:
Can this be done with drupal?
How?
Any article about this?

Thank you
Smo

Comments

Documented

This is extensively covered in the handbooks, but the short answer is that the installer asks you for a prefix that can be applied to table names. That allows you to run multiple, completely separate instances of Drupal in a situation where your hosting provider limits you to a single database.

Not my case?

Hello yelvington, thanks for the quick response.

Maybe I am blind (or more likely too dumb to understand), but as far as I see it, mutlisite is not the solution for my case. My understanding is, that mutlisite is done with multiple tables for each site.

As I described above, I want to share some of the content: one site should show only one category, while another site should display that category as well as others.

My undersanding is, that this will not be possbile, if I use different tables for each site, how should I share content then please? (I am not asking for a step-by-step solution, I just don't understand how this should work in general). I hope you can help me to understand what my mistake is (Or maybe my explanation was not clear enough?).

Thank you
Smo

You can set up the database

You can set up the database prefixes in each site's settings.php as an array, so some tables can be shared across all your sites by having the same prefix: check out around line 80 in the file (Drupal 5.1).

But if you want to split your data up at the sub-table level - you seem to suggest you want some *rows* to appear in one site, and some in the other - then you really have to do that at the programmatic layer, which might mean by specifying arguments in your views, or maybe even hardcoding the choices into your theme or a bespoke module.

--
J-P Stacey, senior developer, Torchbox Ltd.

Thanks jp.stacey. I am a

Thanks jp.stacey.
I am a little confused again because of your table/row separation.

I understand, that if I use an array for tbale prefixes, I could (in my example) use
'apples' = "shared_";
'melon' = "shared_";
'fruits' = "main_";

This would allow me to have melons articles only on http://www.melons.com/, apple articles only on http://www.apples.com and apples, melons and others on http://www.fruits.com. Is this correct?

Then I understand your posting so, that it would just not be able to have one specific apples article in the melon page. If this is correct, then this would not be a problem for my case. Before I continue, is my understanding correct so far?
Thanks
Smo

RSS

It won't work the way you describe. There is not a relationship between a database table and a subject or topic.

A simple solution would be to syndicate the content using RSS feeds based on taxonomy, and use a node aggregator module such as Leech to ingest the syndicated content. A "main" site would have everything and would be the origin point. Topical sites pull data from the main site based on taxonomy terms.

But this would mean a lot

But this would mean a lot slower system, correct? As pageb.com will pull the data from pagea.com in RSS format and then render it and display it on pageb.com, correct?

Also what did I misunderstood then? What was the prupose of creating an array inside the settings.php please?

No

No, it would not be slower. RSS feeds are fetched, parsed, and stored in the database on a cron basis. This is true whether you use the standard Drupal aggregator or one of the various other aggregators that create full-fledged nodes.

The example $db_prefix array in settings.php shows how tables can be shared across multiple sites, but it is NOT something to be attempted without a very thorough understanding of the Drupal database schema. And it will not work for sharing only a subset of content (in other words, it's all or nothing).

I do slightly beg to differ

I do beg to differ...I have worked on a large but now defunct project previously and whilst very agonising i managed to have SITE1 As a master site and SITEB SITEC SITED etc totally seperate sites they shared their users and certain "features" but the context was this.

SITE1 was a motorsport website....various "teams"/"Drivers" etc could host their own websites with us. All the content/news articles photo galleries were inputed into SITE1 but their site, SITE2, would show only content relevant to them...taxonomies, and a few other terms and things were used but hell it worked well.....

Everyone said it couldnt be done and it was......
Would I do it again....yeah but it'll cost :D

=========================

Been away from drupal for 12 months, health and other reasons.
Worked on some very cool drupal projects and I am starting some more currently.....looking forward to a drupalised future.

Been away from drupal for a while.......health and other reasons.
Worked on some very cool drupal projects and I am starting some more currently.....looking forward to a drupalised future.

nobody click here