re-reading the multi-sites posts again - i've gotten myself into a brain muddle. It alos seems the more times i read multi sites the more confused I become - so i need to keep my quetions very simple, becuaw the different options leave me baffled.

I'm thinking this, in theory, should be very do able.

web sites:

site one - mobile.example.com
site two - www.example.com or example.com

share the same mysql database and tables for both (and users)

but in order to have different themes (I saw a post that there is a mobile theme)

I have to load ? two copies of drupal?

or can i get away with just using one set of modules and have two different themes? this is where I get a bit muddled and is

also if someone has done a mobile, I'm thinking there are going to be some twists and challanges from the basic nature of the differences between the two different display medias. does anyone have any lessons they have learned from such a project?

I'm thinking for basics the mobile site would probably be a single column site, where as, the regualr site could be a three column site ?? but could this be possible if using the same modules at boht sites?

thanks

Comments

adrian’s picture

for mobile.oasismag.com. It isn't strictly a multi-site issue.

1) Make sure you have dns entries for www.mysite.com and mobile.mysite.com pointed to the same virtual host.
2) create 1 config at sites/mysite.com/settings.php
3) add the following code to the end of that config :

 $parts = explode('.', $_SERVER['HTTP_HOST']);
 if ($parts[0] == 'mobile') {
    $GLOBALS['theme_custom'] = 'mobile';
    $base_url = $_SERVER['HTTP_HOST'];
 }

The mobile template disables the sidebars completely, apart from at the bottom of the text, where it gets the user login box if not logged in or the user menu when you are logged in.

It is also _very_ light on css, and has no tables.

--
The future is so Bryght, I have to wear shades.

cybe’s picture

I've got it working, but not always?

This works:

 $parts = explode('.', $_SERVER['HTTP_HOST']);
 if ($parts[0] == 'mobile') {
    $GLOBALS['custom_theme'] = 'mobile';
    $base_url = "http://mobile.100777.com";
 }

changed "theme_custom" to "custom_theme" and the base_url part didn't work like adrian's code for some reason.

this one also worked: (from http://drupal.org/node/6931)

if ($_SERVER['HTTP_HOST'] == 'mobile.100777.com') {
    $base_url = 'http://mobile.100777.com';
  $GLOBALS['custom_theme'] = 'mobile';
}

But the strange thing is that some nodes work, the mobile theme is used, but not for all, and I can't seem to see why.

http://mobile.100777.com/ works
http://mobile.100777.com/taxonomy/term/48/list works
http://mobile.100777.com/spiritual/1361 works
http://mobile.100777.com/spiritual/daily_remembrance_chart Does NOT work

I'm don't see the reason for it? Can anyone here perhaps offer some insight?

jmnormand’s picture

Just updated my site with the mobi theme using this method. only 2 points:
1. as stated there is a typo its 'custom_theme' not 'theme_custom'
2. i suspect it is because of drupal 5 but the $base_url line is not needed and doubles up on the url for the links, thus braking them.

my code:

 $parts = explode('.', $_SERVER['HTTP_HOST']);
if ($parts[0] == 'mobile') {
    $GLOBALS['custom_theme'] = 'mobile';
}

Jason M Normand

the Geek Touch - a helping hand for high tech
http://www.theGeekTouch.com

Bèr Kessels’s picture

It does not do exactly what you want, but it comes as close as you can get without coding.

---
if you dont like the choices being made for you, you should start making your own.
---
[Bèr Kessels | Drupal services www.webschuur.com]

tweaker’s picture

thanks Adrian and Bèr, i also opened a mobile info collection thread, maybe it will work maybe not - guess we'll just have to wait see

robertDouglass’s picture

You can do the theme switching the 'traditional' multisite way, in other words like you initially imagined it - two sites sharing all content and modules etc.

you need:

sites
-- site.com
----settings.php
-- mobile.site.com
----settings php

the mobile settings.php should still have this line from Adrian's example:

$GLOBALS['theme_custom'] = 'mobile';

this will handle the Drupal bit. Then you need to have a symlink from wherever your Apache thinks the subdomain root is to the drupal root.

- Robert Douglass

-----
If this helped you, please take the time to rate the value of this post: http://rate.affero.net/robertDouglass/

www.hornroller.com, www.robshouse.net

my Drupal book | Twitter | Director, Product Operations Commerce Guys

tweaker’s picture

as simple as you guys make it sound, it was an uphill push all day. but thats ok, it will be easier next time :-).

I think i have it finally, all except for that last part... the theme

1) I am using one set of code
2) I am using one user base
3) same database and tables
3) I see both sites

mobile.cybereze.com
cybereze.com

I think i'm doing something wrong and silly not to get the theme part right.

I have two files:

node.tpl.php
page.tpl.php

I put them in a dir;
/sites/mobile.cybereze.com/themes/mobile/

at the bottom of my:
~/sites/mobile.cybereze.com/settings.php i have this

//$conf = array(
// 'site_name' => 'Mobile CyberEze'
// 'theme_default' => 'mobile',
// 'anonymous' => 'Visitor'
//);
$GLOBALS['theme_custom'] = 'mobile';
?>

where am i goofing it up?

thanks

robertDouglass’s picture

Sorry if this is a dumb question, but the custom theme override will only work if the mobile theme has been enabled. Since I can see myself not doing this and banging my head I thought I'd ask :-)

- Robert Douglass

-----
If this helped you, please take the time to rate the value of this post: http://rate.affero.net/robertDouglass/

www.hornroller.com, www.robshouse.net

my Drupal book | Twitter | Director, Product Operations Commerce Guys

tweaker’s picture

Drupal 4.6.2 multi-site mobile

Robert,
I'm glad you're thinking somethng basic :-)

This is what i did over the weekend.

mutli-site working well:
http://mobile.cybereze.com
http://cybereze.com

to take the actual theme out of the picture
I am running both sites using "pushbutton" - thought ok, pretty stable theme, lets try it.

I just can't seem to get the "mobile" theme to go live and I don't see it to in "themes" to enable it. Must be doing something goofy.

opne to all suggestions - I thnk its something silly and simple

thanks

tweaker’s picture

well you were right, it was something simple - i just noticed it. duh .. load phptemplate. i guess I was thinking it didn't need it.

off... to test it.

the full octave’s picture

hiya,

Was following this thread with interest and tried to click through to view your site...

is your site down or did it not work for you?

thanks

Paul

tweaker’s picture

I'm sorry that link isn't up right now.

I had to change Host's and haven't had the time to load that one back up yet.

I also want to change the sites' purpose.

orionvortex’s picture

I tried the first method that adrian suggested and it almost worked. The site appeared under the mobile theme except I had one problem. At the top of the page I kept getting this error:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 748

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 550

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 551

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 552

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 553

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/chibabea/chibabeat.com/sites/default/settings.php:1) in /hsphere/local/home/chibabea/chibabeat.com/includes/bootstrap.inc on line 554

Does anyone have any idea what I might have done wrong in the settings.php file?
http://chibabeat.com/

Florian’s picture

Make it simple but not simpler :)

1) You should uncomment in the mobile.yoursite.com/settings.php nad have the following lines:

$conf = array(
#   'site_name' => 'My Drupal site',
  'theme_default' => 'YOUR MOBILE THEME NAME',
#   'anonymous' => 'Visitor',
);

2) Do not forget to add the following line to your robots.txt in order to avoid duplicate content:
Disallow: /mobile/

------
Florian
Dr.Radut | Puzzle IT | EU Copyright Office | STReight

Florian