Hi again,
For some reason, I am unable to make this module work as expected. If I understand correctly, this module allows you to create browser specific CSS files that are loaded only when said browser is used. No matter what I try, the module seems to be loaded browser-specific CSS files in every browser.
For example, I have created a Firefox specific CSS file named firefox-style.css and added it to my theme using Browser Theme Settings configuration. I can then verify that the CSS file is being loaded, both because of its effect on the page rendering and by looking at the source of the loaded page.
The problem is that this CSS file, which is supposed to be specific for Firefox, is also loaded by other (non-gecko) browsers (Chrome and Epiphany in my testing).
I am not sure if I am doing something wrong or if this is a bug.
By the way, the Browscap module is installed and enabled; I can see the user agent reports, so I assume that it is running as it should.
I look forward to your advise. Thanks!
Comments
Comment #1
markhalliwellHi kokitomare :)
Do you have this installed on http://haikuzone.net ? Or is this for another site. I could possibly troubleshoot if you were to upload some screenshots as well. Take some of your rendered source HTML, your directory where the files are located, browser themes settings configuration page and your theme's .info file. Zip them all together and then attach :) I might need to revise the instructions if this is just a communication error ;/ lol
Also, feel free to message me at http://drupal.org/user/501638/contact if you have any IMs you use for faster communication ;)
Comment #2
markhalliwellIt honestly sounds like you have page caching enabled (/admin/settings/performance). If so, you should be using the cache include (instructions and explanation on the project page). Although it could just be that the cache needs to be clear so the variables load and other settings load properly. I've been thinking about calling drupal_flush_all_caches() when browser theme settings saves, just to ensure that all the pages, blocks and variables are referenced correctly.
Comment #4
markhalliwellComment #5
ilfelice commentedHi markcarver,
Thank you for the prompt response and very sorry for the delay; it has been a bit hectic here lately.
The site -- which is not http://haikuzone.net -- is still in development, so I am keeping all caches and CSS/JS optimizations in /admin/settings/performance disabled. These are the CSS files defined in the theme info file:
They all load in the expected order. The Firefox specific CSS file that I am trying to use is named firefox-local.css; I also tried with firefox-style.css, but to no avail: the alternative CSS file loads last, which is expected, but it loads regardless of the browser. I wonder if I the naming of the CSS if correct. Can you confirm?
Comment #6
markhalliwellHey kokitomare :)
Ok, try this:
Take all your CSS files and JS files and put them in Browser Theme settings located at /admin/build/themes/settings/YOUR_THEME. Then remove them from your theme's .info file. Clear the cache. This should resolve your issue.
Also you might try installing the cache include (instructions on the project page) to test since you're site is in development anyway. This at the very least will certainly create separate caches of variables and other system settings per browser. Might help :/ Let me know how that goes. I'm still working on creating a very detailed (and hopefully easy to understand) handbook.
Comment #7
markhalliwellIs there a way I can view the site?
Comment #8
palmaross commentedI also don't understand how this module works...
I created files in this orden:
opera-cross.css
ie-8-cross.css
ie-7-cross.css
safari-cross.css
cross.css
Now when I browse site via opera or IE or safari, in source HTML I see all this linked files exept cross.css...
In IE8 I see both ie-8-cross.css and ie-7-cross.css
And when I use FireFox, I see all these files and cross.css too...
I tried it with caching enabled and disabled, inmediatly after clean cach, and I put string $conf['cache_inc'] = './sites/all/modules/browser_theme/cache.inc'; in my settings.php
Nothing...
Module Browsecap works fine... I checked it and I see right statistic.
Comment #9
markhalliwellpalmaross, please follow the directions in #6. It seems that your theme's .info file is populated with these files. This module essentially replaces the need to specify CSS and JS files in the .info file. However it seems that some sort of option to ignore files listed in the .info file should be in place.
Comment #10
palmaross commentedWell... my .info file has no file cross.css ...
It has only one css related line: stylesheets[all][] = css/fusion-gepard-style.css
I thought that the (css) purpose of your module - make css corrections for different browsers ... And for that purpose I don't need to replace entire css theme file, I need only minor changes for each browser. And the most logical - elaborate small css files - as opera.css, safari.css, and, in some cases, opera-9.css or firefox-3-2.css ... And so, depending on the browser, I could load needed file. I think this behavior - the most logical?
For example, now I use Browscap.php for this purpose. I easily get variables $browser, $majorver and $minorver from output array of this file, then I prepare variable $css, eg:
and so on...
and then I link the needed css file:
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/fusion/gepard/css/<?php print $css.css ?>It works fine for me - each browser has own css file, and I can easily elaborate any condition (if... else... etc), and so I have quite a flexible system of "browser depending css corrections".
And I thought that the "css behavior" of your module is more or less similar, because it's most logical... or no?
Comment #11
markhalliwellFirst, you should NOT manually set your CSS or JS files in your template pages (please see the Garland theme's page.tpl.php file for an example, also please read http://drupal.org/theme-guide/6). You should let Drupal set your styles and scripts, this is required so that any additional modules (ie: Browser Theme Settings) can populate these files properly. This is more than likely why you are having issues.
Also, typical CSS and JS implementations require you to specify your files in the theme's .info file. This is the accepted standard and works just fine if you wish to have these files on every page. However, this module cannot preprocess these files nor remove them automatically. This is why they must be removed from your theme's .info file and moved into your theme's configuration page under Browser Theme Settings. This module is essentially a way to take over a theme's static CSS and JS files.
This module does not change or replace anything, it simply takes the (base) files specified in Browser Theme Settings on a theme's configuration page and then looks for the appropriate browser file automatically. Please look at the the screenshot (http://drupal.org/node/817858).
The Garland theme has the following Browser Theme Settings:
CSS:
1. css/default.css
JS:
1. js/settings.js
2. js/script.js
3. DELETE ME! (this will not be saved because Browser Theme Settings will ignore base files that do not exist)
This means: This module will automatically look in the same directory (css/) where default.css is located and try to match: browser[-major][-min]-default.css. If no file is located, then it simply loads css/default.css.
There is no need to specify safari-default.css in the Browser Theme Settings page, this only makes the module look for: browser[-major][-min]-safari-default.css.
Comment #12
markhalliwellMarking as fixed due to email received from original author and no responses from palmaross after my last post. If there are anymore issues, a new ticket should be created. DO NOT continue posting on this ticket.