I haven't seen this one mentioned before.
say we have several working sites with the following base urls
example.com/
example.com/red
example.com/green
example.com/yellow
example.com/blue
using custom settings.php files in the sites/ directory and distinct themes by placing themes in sites/sitename/themes, we have several customized sites.
PROBLEM:
we want to manage the example.com/red, example.com/green, example.com/yellow, example.com/blue *content* from the "master" site located at 'example.com/'.
we're sharing all tables, but we want to target node entries to specific sites. for example. we want an about page for each site. so from our master site we create 4 different about pages and for each of these pages, we specify one of the subsites. each subsite then displays the appropriate about page.
for any piece of content created, we want the ability to display it on none, some, or all of the subsites.
ideally we will completely turn off the admin interfaces for the subsites and manage them exclusively with the files in the sites/ dir (where we'll specify site details/settings) AND our master site (where we'll generate content for the subsites).
it seems to me that i might do this by adding a custom field to all content input forms using 'hook_?' and then applying a filter to all requests for content using hook_filter.
i can't believe i'm the first one to come upon this problem.
Comments
OG?
You could create organic groups for red, green, yellow, etc., alias the group home pages to match the sub directories, and then you'd always have the option (based on user permissions, of course) to publish to one or more of the "sites", all the while managing the whole site from the top level. Groups can have their own themes.
The other option might be *not* to share all of the tables, but just the user/login related tables (and sequences), and then push/pull content between the sites with the publish module. OG seems like a better fit, though.
- Robert Douglass
-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress
looks like it's not ready for 4.7
i've never used that one.
installed it on my 4.7 site and ended up in 'node_access'/blank page hell. finally had to remove it and restore the dreaded table from hell (node_access) back to factory default.
but i do think taxonomy may be the key.
will report outcome.
--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal
--
Devbee - http://devbee.net/
OG module is ready for prime time
The organic groups module is *the* most actively maintained module in the entire contrib repository, with no fewer than 4 of Drupal's finest working on it. If you had a problem, make sure and open an issue... it will get addressed. I think the OG solution is the closest to what you described out-of-the box.
- Robert Douglass
-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress
Solution
OK, here's how I solved it
1) created a new vocabulary whose terms consisted of labels for each of my subsites.
2) created mysql5 views for each of the subsites:
3) modified settings.php (sites/example.com.subsite/settings.php). Added the following:
I'm going to have to configure my subsites so that it's not at all possible to create content from within them. All content will be created from the main site and targeted to subsites using vocabulary tags.
--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal
--
Devbee - http://devbee.net/
Very crafty
This is prime material for a handbook page.
- Robert Douglass
-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress
good suggestion
i'll write it up and submit.
--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal
--
Devbee - http://devbee.net/
Handbook page
Harry,
Any news on the handbook page? This could come in very handy.
Thanks.
How about Primary Navigation Menus?
This is a tremendous help, thank you very much for posting this.
I had a similar problem as you, with the twist that some content needs to be shared between the multiple subsites. Easy enough: I created a vocabulary with three terms: "red," "blue," and "shared." Items tagged with "red" should only be viewable on example.com/red, items tagged with "blue" should only be viewable on example.com/blue, and items tagged with "shared" should be viewable on either.
I modified your code slightly as such:
"... AND (td.name = 'red' OR td.name = 'shared')..."for the red_node View, and similarly for the blue_node View. This appears to work fine.
I now have a related question. How would you create a custom primary navigation scheme for each subsite?
Lets say you want example.com/red to have the following primary menu scheme:
* red artists
* red movies
* red books
and example.com/blue to have the following primary menu menu scheme:
* blue artists
* blue movies
* blue books
(As per my explanation above, some content can be tagged as "shared," and can be referenced by both sites. Not super relevant at the moment, though.)
Since there is only one "menu" table, how could this be done? Would it involve creating two prefixed menu tables, such as "red_menu" and "blue_menu?" Or is there some simpler solution involving red and blue Views of the "menu" table?
Much thanks in advance for your input.
Extending Navigation?
I don't know why navigation menu items shouldn't be tagged with a taxonomy also..
What it would entail is creating a new lookup table in the db. Look at term_node for the node/term lookup table. It has two columns: nid (node id) and tid (term id).
I propose a new table "term_menu" with two columns: mid (menu id) and tid (term id).
Then, you have to add the taxonomy option to the navigation form (both the menu editor and the one that pops up when you add a new page, etc). Then, you'll need to edit the insert/update statements everywhere they appear.
Then you could create a MySql view of the menu table that would filter by the term_menu table's entries.
UPDATE:
It looks like taxonomy is quite a bit more integrated into the nodes and themes than I previously thought. I've gone thru node.module and taxonomy.module and it's going to require changes in a lot of places to get it to work right. There may be a way to make a module that will hook into menu and extend it (like taxonomy extends node). I'm looking into this.
A quick hack would be to add a new string/varchar column to the "menu" table, called "site" or something, and then set a new view:
..replacing [subsite] with the string of your choice.. Then browse the menu table and add [subsite] to the new column you just created (on the rows with the menu options you want to filter).
Then add a prefix to the 'menu' table in the array you already made for node:
I figure since we were in the database adding views already (nasty hack), might as well do a little more.. but having to manually edit the database means this isn't a good long term solution. This would work well for static content (like an "About Us" page or something). For the dynamic content, you could add filtered RSS feeds to display certain content on certain sites..
I'm going to look around for a better solution, but this should work for now..
Not unproblematic!
This solution is very nice, and I will maybe use it myself ( + additional overriding the theme from settings.php + theme-specific menu blocks):
But, when using this you need to be aware of "dangerous" intrapage links.
E.g. if you have an article "red -> red cars" and you link to "node/1234" which is a "blue -> blue mitsubishi" => page not found (but, when viewing it from the main page, you can normally browse it.) here you need to provide the complete link i.e. www.mypage.bla/blue/1234 . (since ../blue/1234 wouldn't work from the main page...)
Is there a solution for
Is there a solution for showing the nodes of subsite's frontpage into the frontpage of mainsite?
I wanna just to show subsites node into the mainsites's frontpage.
Thanks
update?
Hi there, I'm looking at doing something similar now, 2010, was wondering if there are modules/methods of accomplishing the above now that would be better than the methods suggested above.
cheers,
vanilla drupal
What I do is using multiple sites pointing to the same DB, overriding a few variables (theme, start page) in settings.php, and using views and taxonomy.
Postings to various websites
I run 9 drupal websites. One main website. When a story is posted I would like to be able to assign it to one or more websites from one content page. Any ideas and anyone willing to build it for a fee?
Dirk
Domain Access
You could run all 9 sites off of one Drupal install using Domain Access, http://drupal.org/project/domain and share content between all (as per settings or on a per node basis). Not sure about importing existing sites into the Domain Access method though... looks to be possible, but would definitely add to the learning curve if you are unfamiliar...