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

by Stephan Borg
Friday 01 of July, 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

Post Comment
If you are already registered with bitweaver please enter your login details above.
Sorry, we have to ask.
Anonymous Post
   

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}
?>


;)