View Full Version : Will 'if_browser=ie' work in php files?
Razasharp
01-18-2007, 01:01 AM
Just wondering, will this work in the php files?:
if ((is_browser('ie', 5) OR is_browser('ie', 6))
{
Do this
}
Cheers
akanevsky
01-18-2007, 01:04 AM
No, the function is a javascript function and will work only within javascripts.
Razasharp
01-18-2007, 01:11 AM
Ah right... thanks.
I guess there's no way to test what browser someone is using via PHP then?
Adrian Schneider
01-18-2007, 03:38 AM
Take a look at how vB. does it (functions.php) // ################################################## ###########################
/**
* Browser detection system - returns whether or not the visiting browser is the one specified
*
* @param string Browser name (opera, ie, mozilla, firebord, firefox... etc. - see $is array)
* @param float Minimum acceptable version for true result (optional)
*
* @return boolean
*/
function is_browser($browser, $version = 0)
Here you go, and yes these functions will work in the .php files, plug-ins, and templates. :)
https://vborg.vbsupport.ru/showthread.php?t=107538
Razasharp
01-19-2007, 02:00 AM
Thanks both.
Would I need to re paste the function in the script I want to use it? Or use a different if statement?
Or can you give me some pointers in what I have to do in order to get an if statement like in Post #1 to work in the class_bbcode.php script?
Appreciate any help!
Thanks.
Thanks both.
Would I need to re paste the function in the script I want to use it? Or use a different if statement?
Or can you give me some pointers in what I have to do in order to get an if statement like in Post #1 to work in the class_bbcode.php script?
Appreciate any help!
Thanks.
As long as functions.php is loaded you'll be able to use the above function. Functions.php is loaded around line 140 of init.php, so it should always be there if you need it.
Razasharp
01-20-2007, 03:13 PM
Thanks Brad.
So basically, this should work?
if ((is_browser('ie', 5) OR is_browser('ie', 6))
{
Do this
}
Yes that works, however. ;)
if (is_browser('ie', 5) OR is_browser('ie', 6))
{
// Do whatever here
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.