From: Geoff S. <ge...@ho...> - 2001-12-23 19:02:51
|
We heavily customized TheBixIce for our website www.RadioLeft.com before discovering that it didn't work with oledr versions of Netscape. So, I decided it would be easier to set up a separate theme for Netscape. So, I customized slurpee to work on older Netscape. I'm using HTTP_USER_AGENT to differentiate between browsers. I also have a rule. We make NO CODING changes to the core code, only the theme. I violated this rule slightly by modifying the config.php. To see how this works, go to www.RadioLeft.com using a current Netscape browser (6) or Internet Explorer. You will see a different theme depending on which browser you use. Also, I created a "dropinpage" script that allows you to create any kind of custom page you want and simply "drop it in". This allowed me to put browser specific code in the system without modifying the core. Again, check this out using a current Netscape browser or Internet Explorer and with old Netscape browser and you will see the differences. http://www.radioleft.com/shopping_dropinpage.php By the way, for whatever reason, the IE version of the above page blows up on old Netscape due to some java scripting in the page. Here's the code for the drop in page module: http://www.hostricity.com/content.php?menu=28&page_id=41 And, here's the code that differentiates the browsers and can be used in various forms in the dropinpage module and in config.php. Here's the config.php code (again - nothing special about this code. In fact it is rather crude. But, I think the idea of implementing browser specificity via automatic theme control is pretty clever! ################### # Default Theme # ################### $agent = getenv("HTTP_USER_AGENT"); if (preg_match("/MSIE/i", "$agent")) { $default_theme = "TheBixIce"; } else /* Microsoft and Opera eliminated */ { if (preg_match("/Netscape/i", "$agent")) { $default_theme = "TheBixIce"; } else /* New Netscape eliminated */ {if (preg_match("/Mozilla/i", "$agent")) /* Browser is old Netscape or old Internet Explorer */ { $default_theme = "slurpee";} } } /* $default_theme = "TheBixIce"; #Set this to the theme of your choice. Note #you MUST leave the Default Theme directory #even if you wish to use a different theme #as default. */ Geoff |