"0.0.0", "Name" => "unknown", "Agent" => "unknown", "AllowsHeaderRedirect" => true) ; public function __Construct() { $browsers = array("firefox", "msie", "ipod", "iphone", "opera", "chrome", "safari","mozilla", "seamonkey", "konqueror", "netscape", "gecko", "navigator", "mosaic", "lynx", "amaya", "omniweb", "avant", "camino", "flock", "aol", "playstation 3"); $this->Agent = strtolower($_SERVER['HTTP_USER_AGENT']); //print_r($this->Agent); foreach($browsers as $browser) { if (preg_match("#($browser)[/ ]?([0-9.]*)#", $this->Agent, $match)) { $this->Name = $match[1] ; $this->Version = $match[2] ; break ; } } $this->AllowsHeaderRedirect = !($this->Name == "msie" && $this->Version < 7) ; } public function __Get($name) { if (!array_key_exists($name, $this->props)) { die; } return $this->props[$name] ; } } function smarty_cms_function_browsertools($params, &$smarty) { global $gCms; $config =& $gCms->GetConfig(); if ($params['action']=="sniff"){ $browser = new Browser ; $Output = array(); $dotReplace = isset($params['dotReplace']) ? $params['dotReplace']:'.'; $Output = explode(',', $params['Output']); foreach ($Output as $value){ $ValueIS=$browser->$value; $ValueIS=str_replace(".", $dotReplace, $ValueIS); echo " " . $ValueIS . " "; } } //result when client using Firefox 3.0.11 //firefox 3.0.11 // //result when client using unknown browser //unknown 0.0.0 // //etc etc //Version //Name } function smarty_cms_help_function_browsertools() { ?>

What does this tag do?

How do I use this tag?

Just insert the tag into your template/page like in one of the examples here:
1. {browsertools action="sniff" Output="Name,Version"}

What parameters does it take?

Uses for what parameters output?

1. {browsertools action="sniff" Output="Name,Version" dotReplace="-"} Outputs something like msie 7-0 which can be used in classes class="{browsertools action="sniff" Output="Name"} V_{browsertools action="sniff" Output="Version" dotReplace="-"}" giving class="msie V_7-0"
2. {browsertools action="sniff" Output="Name"} Outputs something like msie which can be used in a script name <link rel="stylesheet" href="/lib/Master-<CODE>{browsertools action="sniff" Output="Name" dotReplace="-"}</CODE>.css" type="text/css" media="screen" /> giving <link rel="stylesheet" href="/lib/Master-msie.css" type="text/css" media="screen" />

What are the browsers it will pick up?

"firefox", "msie", "ipod", "iphone", "opera", "chrome", "safari", "mozilla", "seamonkey", "konqueror", "netscape", "gecko", "navigator", "mosaic", "lynx", "amaya", "omniweb", "avant", "camino", "flock", "aol", "playstation 3"

Author: jeremyBass <jeremybass@cableone.net>
Website: CorbensProducts.com
Support more mods like this:


Version: 1.0 beta, 10.26.2009

Author: jeremyBass <jeremybass@cableone.net>

Version: 1.0, 10.10.2009