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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 19:42:43
Script start
Timing: Jan 30 2025 19:42:43
Module start 'layout'
Timing: Jan 30 2025 19:42:43
Module start 'content'
Timing: Jan 30 2025 19:42:44
Module end 'content'
Timing: Jan 30 2025 19:42:44
Script end

Main resources:

Total runtime1.2475 sec
Peak memory usage8,192.0000 KB
Database Queries58

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.0078151.1953
Module start 'layout' 0.00640.0051 739.2031220.6641
Module start 'content' 0.01151.2350 959.86724,446.0156
Module end 'content' 1.24650.0009 5,405.88287.8828
Script end 1.2474  5,413.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2958160.0002
Check MTime0.00130.1081160.0001
Mysql Total
Database connection0.00090.070910.0009
Mysqli_queries1.151192.2748580.0198
Looping result0.00070.0586560.0000
Template Total1.185195.020.5925
Template load0.00210.170620.0011
Template processing1.182994.826920.5915
Template load and register function0.00140.112210.0014
states
state_id_array0.00210.168410.0021
state_identifier_array0.00250.197220.0012
Override
Cache load0.00180.1405200.0001
Sytem overhead
Fetch class attribute can translate value0.00250.204420.0013
Fetch class attribute name0.00290.229940.0007
XML
Image XML parsing0.00240.191520.0012
class_abstraction
Instantiating content class attribute0.00000.001440.0000
General
dbfile0.00350.2776160.0002
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs