In Smarty, how do I check what browser is being used?

by Stephan Borg
Friday, July 01, 2005
Posted to Developer's FAQ
Here is a code sample for your .tpl:


<?php
{if $gBitLoc.browser.client eq 'mz' or $gBitLoc.browser.client eq 'ie'}
    
This browser is IE or Mozilla based!
{/if}
?>


the end.

Comments

Browser name & version

by Vince Mercer, 17 Nov 2009 (21:33 UTC)
...How about the browser version?

by Vince Mercer, 18 Nov 2009 (00:09 UTC)
Actually, the proper code is:


<?php
{if $gBrowserInfo.browser eq 'mz'}
            
You are using Firefox
{/if}
?>


;)
  Page 1 of 1  1