Hi There -
Hope I'm in the right place for this question. Please let me know if there's a better place to post this.
I'm working on a site that will be need a version for low bandwidth and high bandwidth.
One of the purposes for the site is knowledge transfer from the developed world to the developing world. The users that we'll be serving in the bandwidth challenged regions have speeds that are a lot less than what you'd get with a 56k modem. My collegues who have visited the locations have told me that it's painful to watch. They also are dealing with 600 x 800 screens, and the occasional 400 x 600 screen. Ouch!
Meanwhile, I want the site to be rich enough to accumulate great content so that people and organizations who have whizbang bandwidth will find their experience satisfying as well.
So I was thinking two sites running off the same database. . . or a very light theme and another more bandwidth intensive theme - using bandwidth detection javascript I found.
I'm a newbie at this. (It's my first Drupal site.) These are just my ideas for how it might be done. Neither seems very elegant, but I'm not versed in the PHP world and can't really tell. At this point, the size of a second site wouldn't be a huge issue since it will be reading from the same database, but it seems an inelegant solution. I'd have a redirect if the user is coming from a low bandwidth location.
I don't know whether it's possible to do a redirect if it's another theme.
I'm happy to entertain any other ideas anyone else has. Like I said, I'm clueless. Also, if you can foresee any pitfalls that await me that are obvious to you, I'd be grateful if you let me know.
Thanks,
Lee
Comments
Hmmm... I'd probably just
Hmmm... I'd probably just have a "low bandwidth version" button (I know that can be done -- but I don't know how to do it myself...). I don't think its something you can detect automatically.
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
http://www.nicklewis.org
--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.chapterthree.com
Oh my! I feel like I've
Oh my!
I feel like I've been visited by a celebrity! Nick! I love your site! Your tutorials have helped me immensely!
Check it out! Found a bandwidth detection script at this location:
http://dhtmlnirvana.com/content/dhtml/bandredirect/band1.html
It sends a tiny file and counts how long it takes for the user to download it. Then redirects accordingly.
I was thinking to have a button like you described be the first thing that loads / appears, but also it would be very cool to have the first version that it loads automatically be appropriate for the bandwidth.
The redirect script detects bandwidth and sends the visitor to one page or another. However, if we can figure out how to make the site automatically go to a lite theme, then there would be no need for a duplicate site.
My biggest concern (as a complete newbie who doesn't yet know what to be concerned with) is how to treat images. If we're able to create another site, what do we do with the folder where the images upload? If it's a theme, is there a way to tell it to use just the tiny thumbnails?
I don't understand how images are accessed or stored vis-a-vis the database. Is the database storing the images as digital data (I know that some do, but I don't think this one does) or are they living in the 'files' folder or somewhere else. Can I tell the duplicate site to look for images in the 'files' folder of another install or is there a way to automatically copy thumbnails to the lighter site.
I'm really stuck on thinking this through well.
Please bear with me.
If we go with the light theme version of the same install, then I'm stuck on figuring out how to redirect to the light theme if someone has low bandwidth. Another issue is telling the light theme to use all thumbnails on the images.
If we go with the light install version, where there's a redirect to the index.php of another install, is there a way to use the same database and reference the same images, but have a light versions of images?
When I talk about small images, I'm thinking of nothing bigger than 2 cm square, unless they're clicked on for a bigger version.
It won't be pretty, but it's more important that it loads at all. My collegues tell me that there's something like only one T1 line going into Ghana, which is one of the places where we want to serve.
Or is there an entirely cooler clever strategy out there that's completely different? I just don't understand the technology well enough to say one is better than the other or that there isn't something better out there that involves a completely different approach.
Nick! Thanks so much for your site! Your tutorials are the best! You've been totally bookmarked on my browser for the last month and a half!
Cheers,
Lee
An opinion from the Second World
I live in Eastern Europe where half the population is on 56K dial up and the other half is on 2Mbit broadband. What I try to do is give the visitor the tools so THEY can make decisions on how they want to view the site. In practice this means a PHP styleswitcher button, and not using too many images on regular article pages -- instead stuffing everything into the image gallery (where on the gallery page pictures are displayed as thumbnails by default).
Doing a redirect without asking the viewer is very rude, prone to technical glitches (what if your speed detection software fails?), and search engines will delist your site completely.
A very lightweight 800x600 pixel opening theme with option to change, and educating your visitors about how to switch off CSS and images in their browser -- that's what seems sensible to me in this case.
All your points are valid. I
All your points are valid. I agree with them and wouldn't want to do anything rude. Having the javascript fail was something I was concerned with. Had no idea that the search engines wouldn't like it.
We were planning on having such a button be the very first thing to load and appear on the page. I'd love any advice you could give me that would help me implement such a button. I'm only just learning PHP and Drupal, coming from the HTML and Flash universe. The descrepancy is even more vast than what you're experiencing. From what I understand, our collegues have something less than 5k for the bandwidth in the most challenging cases. Their screens are also 600 x 480.
We've just found the Imagecache module that will resize images according to the URL, and we were thinking of putting in a script that would somehow tell it to resize the images to tiny in the light theme. Also not quite sure how to do that either, but you've really pointed us in the right direction.
So, a theme rather than a duplicate site. Now to dig around for theme switching. I'm very grateful to you for your generosity and time.
Thanks,
Lee
Found a tutorial on theme /
Found a tutorial on theme / style switching here: http://stephenhendry.net/node/75 . Can't wait to try it out!
Thanks again for sending us on the right direction.
Any other advice will be gratefully accepted. If anyone has learned anything cool about serving up low bandwidth sites, I'd love to hear what you have to say.
Thanks again,
Lee
Styleswitcher module
Here's the code that I use (save this as 'styelswitcher.module' and put it in a folder in your module directory):
<?php
// $Id: style_switcher_text.module,v 1.0 2005/05/06 18:45:00 Christian Zwahlen Exp $
function style_switcher_text_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Display block showing CSS Style Switcher text');
}
}
session_start();
if ( isset($_GET['style']) ) {
$_SESSION['style'] = $_GET['style'];
} elseif ( !isset($_SESSION['style']) ) {
$_SESSION['style'] = 'style';
}
function style_switcher_text_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('Style Switcher Text');
return $blocks;
} else {
$block['subject'] = t('');
$block['content'] .= '<link href="/path/to/your/theme/'. $_SESSION['style'] . '.css" type="text/css" rel="stylesheet" /><ul>
<li><a href="'. $_SERVER['PHP_SELF'] . '?style=style" title="Style: Normal">Normal</a></li>
<li><a href="'. $_SERVER['PHP_SELF'] . '?style=style_alternate" title="Style: Alternate">Alternate</a></li>
</ul>';
return $block;
}
}
?>
Basically, you have a regular stylesheet called style.css. Make this very simple. Then provide an enriched stylesheet called style_alternate.css.
Note: if you have any hard-coded links in your page.tpl.php file, they need to be appended, so users of the alternate stylesheet don't break out of their theme settings:
<a href="http://www.domain.com?style=<?php print $_SESSION['style'] ?>" >www.domain.com</a>As for the thumbnails, I've never done it, but I think it's doable by theming the output of the Image module. In your template.php file you can tell Image to get the value of $_SESSION['style'] and display the original image or the thumbnail accordingly.
Theme or Style????
Thanks! I'm going to try this.
This just switches stylesheets, right?
I'm wondering whether it might be better for the user to switch themes and rewrite an entire theme so that certain material doesn't get to the html to be styled at all.
My thinking is that a stylesheet can render elements invisible, but the browser has to download all of those elements before they can be rendered invisible.
From what I understand, I can have a theme that outputs fewer html elements and then style the truncated html output, making for a lighter experience on the user's browser.
Am I correct?
If so, is there a way to modify the module you've created to switch themes?
I'm trying to muddle through your module right now at PHPbuilder and understand it. Would you mind answering a couple of PHP questions?
The 'path to your theme' part - From where does it reference - from the modules directory? from home? Can you give me an example? I'm REEEELY new at this. (It's my first Drupal site.)
If you could spare another couple of minutes, could you explain the style_switcher_text_block function? I've been trying to figure out what the variables mean and I've been back and forth from PHPBuilder.com and I'm not grokking the $op, $delta, the $block arrays, (they're arrays, right?) and the $_SERVER global variable. (I'm assuming it's a global variable, like $_SESSION is, but when I search the PHP manual at PHPBuilder, it doesn't come up.)
Is there anything I need to change besides the path and the style names?
Extra thanks on the hardcoded links. I never would have thought of that.
Meanwhile, thanks so much for posting this. I'm sure that I'm not the only one who will use it.
Couldn't get it to work, but. . .
Not sure what I was doing wrong, but a friend pointed me to this page: http://drupal.org/project/switchtheme
Home of the SwitchTheme module.
He installed it before my eyes on his local site on his laptop and it worked flawlessly the first time. We put it in the header so it would be the first thing that loaded - that anyone working on a 5k modem would see before the rest of the page loaded.
If anyone else comes up with other strategies for theme switching, it would be terrific to post them here in case someone else is searching.
Thanks for all your help everyone,
Lee