Forums / Developer / server variable

server variable

Author Message

nacer messaoudi

Wednesday 23 February 2011 3:24:36 am

Hi,

How to make $_SERVER['HTTP_USER_AGENT'] in EZPUBLISH?

Thanks.

nacer messaoudi

Wednesday 23 February 2011 5:44:10 am

I have just add and activate ezservervars extension and make :

{def $server_vars=ezservervars()}
{$server_vars['HTTP_USER_AGENT']}

Thiago Campos Viana

Wednesday 23 February 2011 5:48:15 am

Hello and welcome, I don't know if there's a template operator that returns it, but I created an operator that returns the user browser info:

http://ezextensions.googlecode.com/files/get_browser.zip

Usage: {get_browser()|attribute(show,1)}

Enable it in admin interface, regenerate autoloads and clear the cache.

If you really want $_SERVER['HTTP_USER_AGENT'] you could change modify function in getbrowseroperator.php to:

function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{          
          $operatorValue=$_SERVER['HTTP_USER_AGENT']; 

}

PS.: I've just read self Nacer answear, just use that.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br