Hi,
I have been reading about multisite setup and trying all possibilities stated in the great documentation-part of Drupal 4.7.
I didn't find a solution for my problem and so I tried a lot of things myself.
All the posts seen about this, I hope other people can benefit from my trouble.
I will try to be so specific as possible.
1) First you need to set up the master and slave sites. I did this with only one codebase.
So I have one Mastersite: www.master.com and 2 slave sites www.slave1.com and www.slave2.com
(I used Symlink to get the slavesites working. And I use the sites directory for different themes and a different settings.php)
My slave-site settings.php database setup is:
$db_prefix = 'GR_';
$db_name = 'SUR_'; $db_name = 'SUL_'; for the slave2.com
$db_prefix = array(
'default' => 'GR_',
'access' => $db_name,
'accesslog' => $db_name,
'node_access' => $db_name,
'cache' => $db_name,
'permission' => $db_name,
'term_access' => $db_name,
'term_access_defaults' => $db_name,
);
As you can see only the access tables are site-specific.
The modules:
Taxonomy Access Control AND
Nodeaccess
Need to be installed, activated and up-and-running.
2) Create content on the master site.
make content what you also want to post on slave-site, or want to be able to deny access on at slave site.
Let's say that new Content story2 you want to show on slave2.com and not on slave1.com.
Story2 is in development-aid Category/Taxonomy.
You made the Story2 in Development-Aid Category/Taxonomy
The nodenumber of the new content is for this example 10. Nid=10.
3) Pause: now the new node is only on master-tables, so only on GR_ (in my example) and the node_access tables of slave1 and slave2 do not have the new nodenumber (Nid=10). So it will not be accessable.
4) Now comes the Magic!!!
Go to admin of slave1.com and just do the following:
when in the slave1.com Nodeaccess settings page only the [SAVE GRANTS] is clicked..the node_access table from the slave-site will have the new node number included!! (nid=10)
After this the same trick is being played with the Taxonomy Access Control.
(The Taxonomy Access need off course to be set to the correct values for the Terms)
Then only you need to click on [SAVE CATEGORY PERMISSIONS]
Now the slave-site have the correct access rules for the new node with nid=10.
5) Do the same trick with slave2.com.
6) Now the node with nid=10 should be following the rules of the TAC-module settings of the 3 sites and the Nodeaccess-module settings on the three sites.
7) These manual steps needs to be repeated on your time-schedule.
Without these steps the content typed in in the master-site will not be available in the slave-sites (if allowed by the settings).
I couldn't find an easy completely automated solution for this. Please get in touch if you find a completely automated solution!!
I saw that on drupal 5 there is an multi-site module, but not all my 4.7 modules are ported to 5, so that is not an option for me at this moment, and I think this is the truth for more people.
I hope this little tutorial helps others also! Also when I have a failure in this tutorial or somebody doesn't agree on this, please get in contact, because it is not the 100% solution I had hoped for when I started this quest 3 months ago...
Greetings,
Martijn
Comments
Another possibility with views?
I made some research on drupal multi-site with one content base. I actually needed to create a sites network with common content-base because I wanted to be able to publish some articles in more than one site.
I first tried sharing all but variables, cache and settings and by using taxonomy+taxonomy_hide so as to determine on which web site the content will appear. Then I set-up a different theme for each domain and pointed the front-page to the respective taxonomy term I created for it.
This makes the upgrade/maintenance procedure a bit complicated though and might be buggy with some modules.
Then I thought about a similar solution to yours, using TAC and taxonomy hide. It looks like it works fine but is quite complicated too.
Now there might be another way that I still have to test, maybe using :
- taxonomies to say which content goes to which site's front page,
- taxonomy_hide to hide these taxonomies
- views to create the front page of each site.
Once you created your views (one for each domain), you also create or clone a theme for the site and then you setup your domains' settings files with the respective themes and views on the site's theme and front page variables.
In that case I think we don't even need to bother on tables sharing. It looks as if there were many sites but it actually is one site which will show you different theme and front page content depending on the URL you use to access to it.
By the way when you assign a different theme to each site, you automatically assign it a different set of blocks which is a good thing as it helps you to effortless differentiate the features each site will have.
If you use this method, you don't really get separate sites though because the content can be accessed from any domain that uses the same database. If the user manually changes the url on the browser, he can see the same content in any of the sites, there is no access control. It's not annoying for my project but it might be for yours.
The big advantages of this method are that:
- easy to do, no need to play with database prefixes,
- it makes it easy to upgrade/maintain the platform, you keep a clean drupal database setup,
- you can publish some content on one or many different sites, no need to duplicate it or setup specific access rights.
Just an idea though, not tested yet, I'll post if I can make it work.
It looks like my idea using
It looks like my idea using the Views module worked!
More here:
http://drupal.org/node/131036
Follow Up
Hi,
I think the views-method works fine on the frontpage.
But what on deeper pages. If you want node-pages also have different content for different sites.
Is it possible also to handle this with views.
I use the panel module. Can you set different views with panels and different content out of one database on multiple sites?
greetings,
Martjn