<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Browser Detection</title>
	<atom:link href="http://martythornley.com/downloads/php-browser-detection/feed/" rel="self" type="application/rss+xml" />
	<link>http://martythornley.com</link>
	<description>From Photography Blogsites</description>
	<lastBuildDate>Thu, 19 May 2011 11:15:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://photographyblogsites.com/?v=3.2.1</generator>
	<item>
		<title>By: Paul Currah</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-334</link>
		<dc:creator>Paul Currah</dc:creator>
		<pubDate>Thu, 19 May 2011 11:15:18 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-334</guid>
		<description>I have to say, I struggled with this (I am a bit of a PHP noob tho)

BUT, I got it working really well, inspired by this post http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/

The problem with that PHP browser detection is that it doesn&#039;t detect the version of the browser (very important for IE )

I wanted to share what I did with this plugin in simple terms (for other noobs out there):

1) obviously install and activate the PHP detection plugin in wordpress
2) In your theme header.php file, make sure the body tag has the class hook :

&lt;body &gt;

3) In your theme functions.php - add this code:

// PHP browser detection - adds browser to body class
add_filter(&#039;body_class&#039;,&#039;browser_class&#039;);
function browser_class($classes) {
	$browserInfo=php_browser_info();
	$classes[] = $browser = $browserInfo[browser].$version = $browserInfo[version];
	// return the $classes array
	return $classes;
}

This adds the browser and version to the body&#039;s class like so (at the end after all the Wordpress body classes) :

body class =&quot;home page page-id-2 page-template page-template-startpage-php logged-in Firefox3.6&quot;

This is superb as you can distinguish between different browser versions through CSS alone (without any further PHP - which is great for me : )

You could also add the platform as stated above as well, but I thought I&#039;d keep it simple

Hope this helps someone out

Paul</description>
		<content:encoded><![CDATA[<p>I have to say, I struggled with this (I am a bit of a PHP noob tho)</p>
<p>BUT, I got it working really well, inspired by this post <a href="http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/" rel="nofollow">http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/</a></p>
<p>The problem with that PHP browser detection is that it doesn&#8217;t detect the version of the browser (very important for IE )</p>
<p>I wanted to share what I did with this plugin in simple terms (for other noobs out there):</p>
<p>1) obviously install and activate the PHP detection plugin in wordpress<br />
2) In your theme header.php file, make sure the body tag has the class hook :</p>
<p>&lt;body &gt;</p>
<p>3) In your theme functions.php &#8211; add this code:</p>
<p>// PHP browser detection &#8211; adds browser to body class<br />
add_filter(&#8216;body_class&#8217;,'browser_class&#8217;);<br />
function browser_class($classes) {<br />
	$browserInfo=php_browser_info();<br />
	$classes[] = $browser = $browserInfo[browser].$version = $browserInfo[version];<br />
	// return the $classes array<br />
	return $classes;<br />
}</p>
<p>This adds the browser and version to the body&#8217;s class like so (at the end after all the WordPress body classes) :</p>
<p>body class =&#8221;home page page-id-2 page-template page-template-startpage-php logged-in Firefox3.6&#8243;</p>
<p>This is superb as you can distinguish between different browser versions through CSS alone (without any further PHP &#8211; which is great for me : )</p>
<p>You could also add the platform as stated above as well, but I thought I&#8217;d keep it simple</p>
<p>Hope this helps someone out</p>
<p>Paul</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marty</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-333</link>
		<dc:creator>marty</dc:creator>
		<pubDate>Sun, 15 May 2011 02:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-333</guid>
		<description>That would be a nice addition. If you get anything, let me know and I&#039;ll add it. Thanks!</description>
		<content:encoded><![CDATA[<p>That would be a nice addition. If you get anything, let me know and I&#8217;ll add it. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-332</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 15 May 2011 02:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-332</guid>
		<description>Excellent, thank you!

I&#039;ll eventually get around to a screen resolution detection as I feel like that plays a large role, for my site anyway.  But I&#039;m not terribly adept so my code would probably be pretty ugly.  If you got inspired, it&#039;s an idea.  If not, I&#039;ll send you the code when I get around to it.

Thanks!</description>
		<content:encoded><![CDATA[<p>Excellent, thank you!</p>
<p>I&#8217;ll eventually get around to a screen resolution detection as I feel like that plays a large role, for my site anyway.  But I&#8217;m not terribly adept so my code would probably be pretty ugly.  If you got inspired, it&#8217;s an idea.  If not, I&#8217;ll send you the code when I get around to it.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Haughwout</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-331</link>
		<dc:creator>Kevin Haughwout</dc:creator>
		<pubDate>Mon, 02 May 2011 19:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-331</guid>
		<description>I was able to get detectin for Firefox 4 working through an easier and PHP-free solution.  The Browser Capabilities Project has a newer version of the &quot;lite_php_browscap.ini&quot; up at the site whose link you posted.  I replaced the &quot;php_browser_detection_browscap.ini&quot; in my plug-ins directory under WP with this new file, and now the &quot;is_Firefox()&quot; recognizes Firefox 4.</description>
		<content:encoded><![CDATA[<p>I was able to get detectin for Firefox 4 working through an easier and PHP-free solution.  The Browser Capabilities Project has a newer version of the &#8220;lite_php_browscap.ini&#8221; up at the site whose link you posted.  I replaced the &#8220;php_browser_detection_browscap.ini&#8221; in my plug-ins directory under WP with this new file, and now the &#8220;is_Firefox()&#8221; recognizes Firefox 4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saffron</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-330</link>
		<dc:creator>saffron</dc:creator>
		<pubDate>Wed, 30 Mar 2011 10:39:24 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-330</guid>
		<description>thanks for the quick reply.
I managed to solve the problem by using some of the php found on: http://us2.php.net/get_browser

probably not the most elegant way, but I only need a distiction of  firefox yes or no ... and....  i could manage the coding :)</description>
		<content:encoded><![CDATA[<p>thanks for the quick reply.<br />
I managed to solve the problem by using some of the php found on: <a href="http://us2.php.net/get_browser" rel="nofollow">http://us2.php.net/get_browser</a></p>
<p>probably not the most elegant way, but I only need a distiction of  firefox yes or no &#8230; and&#8230;.  i could manage the coding <img src='http://martythornley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marty</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-329</link>
		<dc:creator>marty</dc:creator>
		<pubDate>Tue, 29 Mar 2011 01:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-329</guid>
		<description>Yeah, I had the same thing when Safari 4 came out. Suddenly Safari was not recognized.

I have been relying on a file that detects the browser info from : http://browsers.garykeith.com/downloads.asp

Problem is it doesn&#039;t seem to be able to recognize the next versions. I might have to revisit how I detect the browsers at some point.

In the meantime, I&#039;ll have to update that file. If you are good with PHP, you coud get that new file and find a way to fix the is_firefox function. Otherwise, I will get to it and update the plugin at some point.</description>
		<content:encoded><![CDATA[<p>Yeah, I had the same thing when Safari 4 came out. Suddenly Safari was not recognized.</p>
<p>I have been relying on a file that detects the browser info from : <a href="http://browsers.garykeith.com/downloads.asp" rel="nofollow">http://browsers.garykeith.com/downloads.asp</a></p>
<p>Problem is it doesn&#8217;t seem to be able to recognize the next versions. I might have to revisit how I detect the browsers at some point.</p>
<p>In the meantime, I&#8217;ll have to update that file. If you are good with PHP, you coud get that new file and find a way to fix the is_firefox function. Otherwise, I will get to it and update the plugin at some point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saffron</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-328</link>
		<dc:creator>saffron</dc:creator>
		<pubDate>Mon, 28 Mar 2011 07:51:01 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-328</guid>
		<description>hi marty,
thanx for the plugin.  worked like a charm until i tried it on firefox 4 (on a Mac). Whereas firefox 3 was detected fine, 4 seems to be returning no information.

I am using

$browserInfo=php_browser_info();
$browser = $browserInfo[browser];
echo &quot;browser used: $browser&quot;;

which display &quot;safari&quot; in safari and &quot;firefox&quot; in firefox 3... but echos nothing at all in firefox 4.

I tried
echo $_SERVER[&#039;HTTP_USER_AGENT&#039;] . &quot;\n\n&quot;;
$browser = get_browser(null, true);
print_r($browser);

which does show:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0) Gecko/20100101 Firefox/4.0 Array

any ideas?</description>
		<content:encoded><![CDATA[<p>hi marty,<br />
thanx for the plugin.  worked like a charm until i tried it on firefox 4 (on a Mac). Whereas firefox 3 was detected fine, 4 seems to be returning no information.</p>
<p>I am using</p>
<p>$browserInfo=php_browser_info();<br />
$browser = $browserInfo[browser];<br />
echo &#8220;browser used: $browser&#8221;;</p>
<p>which display &#8220;safari&#8221; in safari and &#8220;firefox&#8221; in firefox 3&#8230; but echos nothing at all in firefox 4.</p>
<p>I tried<br />
echo $_SERVER['HTTP_USER_AGENT'] . &#8220;\n\n&#8221;;<br />
$browser = get_browser(null, true);<br />
print_r($browser);</p>
<p>which does show:<br />
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0) Gecko/20100101 Firefox/4.0 Array</p>
<p>any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marty</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-327</link>
		<dc:creator>marty</dc:creator>
		<pubDate>Wed, 15 Dec 2010 20:51:11 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-327</guid>
		<description>Not just now, sorry. Targeting Chrome isn&#039;t a priority for me as it seems to behave pretty well. I really made this as a convenient way to find the troublesome browsers.
I probably won&#039;t revisit this plugin until maybe February at the earliest.</description>
		<content:encoded><![CDATA[<p>Not just now, sorry. Targeting Chrome isn&#8217;t a priority for me as it seems to behave pretty well. I really made this as a convenient way to find the troublesome browsers.<br />
I probably won&#8217;t revisit this plugin until maybe February at the earliest.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Woody</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-326</link>
		<dc:creator>Woody</dc:creator>
		<pubDate>Wed, 15 Dec 2010 19:35:55 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-326</guid>
		<description>I have tried working around it a few times, but without success. Any ideas?</description>
		<content:encoded><![CDATA[<p>I have tried working around it a few times, but without success. Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Woody</title>
		<link>http://martythornley.com/downloads/php-browser-detection/#comment-325</link>
		<dc:creator>Woody</dc:creator>
		<pubDate>Sat, 11 Dec 2010 16:51:37 +0000</pubDate>
		<guid isPermaLink="false">http://martythornley.com/?page_id=742#comment-325</guid>
		<description>This is in Chrome 8.0.552.215</description>
		<content:encoded><![CDATA[<p>This is in Chrome 8.0.552.215</p>
]]></content:encoded>
	</item>
</channel>
</rss>

