Skip to content

Instantly share code, notes, and snippets.

@ViktorStiskala
Created April 3, 2011 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ViktorStiskala/900053 to your computer and use it in GitHub Desktop.
Save ViktorStiskala/900053 to your computer and use it in GitHub Desktop.
Simple browser recognition
/*
Requires browscap.ini configuration, more info at http://php.net/manual/en/function.get-browser.php
*/
$this->template->registerHelper('browser', function($s) {
$brs = get_browser($s);
if($brs === false)
return 'N/A';
// ex.: Firefox 3.6/Linux
return $brs->browser . ' ' . $brs->version . '/' . $brs->platform;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment