Style Sheet Switcher in PHP
#1
Posted 22 December 2008 - 09:59 PM
Basically I want a script that will determine what browser the user has and implement a particular stylesheet (since some browsers see things wrong or not the same). I'm sure this is possible but I just don't know where to start. I've got ideas but I was told by a programmer that it's risky to try creating code without a base to build from.
Please, I wish learn to learn PHP very badly. Whether it be step by step or in one go, can someone show me how to make such a script?
Note: I would like for it to search in particular for the browsers MSIE, FF, and Opera.
I am well aware of IE conditional statements, and I already know how to use them. But I want to learn and master php, I figure this is a good place to start.
In terms of getting everything together I'm not sure where to start. Any help would be appreciated. I did search but never found something like this.
#2
Posted 22 December 2008 - 11:19 PM
If you want to do it for purely expiremental purposes though, try these searches:
http://www.google.co...owser+detection
http://www.google.co...esheet+switcher
I would like to dispell one myth though: It is risky to program when you don't know what the functions you are using are supposed to do. As long as you avoid system(), unlink(), and other things you aren't familiar with or don't understand after reading the documentation, you will be pretty hard-pressed to actually make a program that could be considered "risky", especially in php. Real programming languages (i.e. C) can produce stuff that breaks things a bit easier.
Edited by rc69, 22 December 2008 - 11:23 PM.
#3
Posted 23 December 2008 - 09:21 PM
#4
Posted 25 December 2008 - 11:12 AM
#5
Posted 25 December 2008 - 01:03 PM
I will look at JS if I pursue it this way then.
Edited by Raven-X, 25 December 2008 - 01:03 PM.
#6
Posted 25 December 2008 - 08:55 PM
Raven-X, on Dec 25 2008, 01:03 PM, said:
I will look at JS if I pursue it this way then.
Actually, it depends on YOU. I learned PHP and some JS at the same time. You're right that AJAX isn't a lang. it is an offset of JAVASCRIPT. That's all AJAX is
#7
Posted 30 December 2008 - 02:29 PM
For instance: A stylesheet switch can be implemented entirely in PHP alone, or JS alone. Mixing the two serves no actual purpose and just wastes bandwidth/server processing time.
Also, AJAX is not an offset of JavaScript, it is a technique:
Wikipedia said:
#8
Posted 30 December 2008 - 03:34 PM
Notice in my first response how I suggested to use it for browser detection.
Offset is defined as a balance for something. AJAX is exactly what that is even though it is JAVASCRIPT.
#9
Posted 31 December 2008 - 01:03 AM
I know you suggested JS for browser detection, which is why recommeded using JS alone (to save the extra HTTP request).
I'm sorry again if what i said was offensive.
#10
Posted 01 January 2009 - 08:05 PM
As i've never messed with browser detection, I probably wont be much help
And not bashing rc69, Because that is a good point. But you can't cater to what most would refer to "power users" and changing your user agent will usually put you in that category when dealing with websites, Probably 0.5% will do that (Even on a tech niche website)
Edited by SatanicPenguins, 01 January 2009 - 08:05 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
