0

So here is the deal, I recently started working on a site, actually three sites that have been split into three drupal installations. These sites have the same function but different appearance. So my thought was to merge them with different themes. Now I have a new issue, two of the three sites are going to allow for others to use their own urls. So www.hiya.com would point to my www.example.com.

Each of these new domains is in our db with what theme it is supposed to be. My first impulse is to look up the site, and change theme in hook_theme(). There are some logic differences but worst case scenario I would just use a session variable to deal with those

I am new to drupal and wanted some thoughts, opinions, criticisms, wild accusations, etc...

4
  • The easy answer would be to have the user sites simply use redirects or mirrors, and not go through drupal at all... is there something in your implementation that wouldn't allow this?
    – Matt
    Commented Aug 16, 2011 at 17:11
  • Requirements don't allow the domain to change so redirects won't work. We are hosting the sites, which would require potentially 3000+ mirrors, which seems a bit silly.
    – badllama77
    Commented Aug 16, 2011 at 17:25
  • If you're hosting all the sites, it should be possible to use . htaccess and mod_rewrite to do this for you. I'm not an .htaccess afficianado, but a quick google search turned up this page: corz.org/serv/tricks/htaccess2.php
    – Matt
    Commented Aug 16, 2011 at 17:30
  • Unfortunately there are several places where a full url is required in links, which gets pulled from drupal, which would reflect the rewrite and not the address bar, and would pull them out of their custom url. Good suggestion though, just this app is kind of a piece of gose
    – badllama77
    Commented Aug 17, 2011 at 16:03

2 Answers 2

1

I've seen this done three different ways. Here they are, from basic to advanced:

  1. Use Drupal's built-in multisite support by setting up different sites in the sites/ folder. This is sort of the "standard" way, and you'll end up needing things like the Features module.
  2. Use Domain Access and all of its modules. This allows you to do all kinds of sharing between multiple sites, and you can generally accomplish a lot with very little coding. Ken Rickard, the owner of that project, will bend over backwards to help you, and you can typically ping him in IRC #drupal-contribute.
  3. A custom module that intercepts the request early in the process (hook_boot, hook_init, and other places in D7) can often give you a chance to initialize the theme layer (and sometimes other subsystems) in a request-specific way. This is how we do our mobile version of our site (in D6), which uses the same nodes and stuff, but has much different template logic.
1
  • Actually the site is in D6, and to be honest not even kept up. My cohort and I are in the process of working around all of the incorrect drupal hacks so we can update. Thanks for the idea of what hooks to use for 3, but I must admit the domain tools look promising. The issue I see I mentioned in response to @keithm I would have to reduplicate the list of registered domains or find a way to look up if there is a hook.
    – badllama77
    Commented Aug 17, 2011 at 16:21
0

The Domain Access suite of modules is designed to address these kinds of design challenges.

1
  • Nice, Domain Alias and Domain Theme would probably do the trick. The only problem is figuring out how to register each new domain with the module. A pattern wouldn't work because two of the three sites are dynamic and the domains can be anything. I will definitely look into this some more.
    – badllama77
    Commented Aug 17, 2011 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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