Announcement
Collapse
No announcement yet.
Conditional for Browser detection
Collapse
X
-
Have to start at PHP_include_start
I too had a problem with this. I spent the past three days working on it, and here is the final solution I came up with.
PHP Code:$rt_checkos = strpos($_SERVER[HTTP_USER_AGENT], 'MAC_PowerPC');
if (is_int($rt_checkos)){
$rt_browser = 1;
}
Then we do our conditional...
PHP Code:<if condition="$rt_browser==1">
This is stuff only a Mac will see...
</if>
Last edited by mcahill; Thu 8 Jan '04, 8:49am.
-
You can use vBulletin's is_browser() function...
is_browser($browser, $version = 0)
<if condition="is_browser('ie')">Do Internet Explorer Stuff here</if>
<if condition="is_browser('mac')">Do Macintosh Stuff Here</if>
The strings it looks for are:
opera
ie
mozilla
firebird
camino
konqueror
safari
webtv
netscape
mac
The second parameter is a for the version number so:
<if condition="is_browser('ie',6)">Do Internet Explorer 6.0 Stuff here</if>Translations provided by Google.
Wayne Luke
The Rabid Badger - a vBulletin Cloud demonstration site.
vBulletin 5 API
Comment
-
Nope.Translations provided by Google.
Wayne Luke
The Rabid Badger - a vBulletin Cloud demonstration site.
vBulletin 5 API
Comment
-
Rats...
I tried that for about an hour yesterday...
I was using MAC_PowerPC though.
Comment
-
Comment
-
It depends...
On what you are trying to do. In my case I was trying to keep my navigation header from showing to MAC users. In that case, you use it in your header template.
On what template does the information you want to tailor to the mac and webtv live? That'll be the place for the if statement.
Comment
-
Originally posted by babydollWould anyone mind pointing me in the right direction to create this fix?
I am having problems with mac and webtv.
Thanks in advance.Translations provided by Google.
Wayne Luke
The Rabid Badger - a vBulletin Cloud demonstration site.
vBulletin 5 API
Comment
-
I have Netscape 4.8 installed to test. I can get it to identify it if I just use netscape, but if I try 4 or 4.8 as the version number, it doesn't work. How can I get it to read if it's an oldie browser?
Comment
-
Anyone could please help me wwwwwith this?
Comment
-
Maybe this conditional is matching version x or higher? For example, if you check for 4, then 5 and 6 will match?
Code:<if condition="is_browser('ie',5)"> <if condition="!is_browser('ie',6)">Internet Explorer 5</if> <if condition="is_browser('ie',6)">Internet Explorer 6</if> </if>
Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment