XF 2.2 Widget condition to get private #-elements of an array (like HTTP headers)

Marcus

Well-known member
In the widget I want to access http headers. In templates I can do that with $xf.request.getServer. With get I access the private #-elements. However in the widget, that does not work.

Code:
array:5 [▼
  "xf" => array:37 [▼
    "request" => Request {[Ctrl+click] Expand all children" target="_blank">#228 ▼
      #server: array:59 [▼
        "USER" => "www-data"
        "HOME" => "/var/www"
This works in the widget to display variables: {{dump($xf.request)}}

How can I get the elements like #server when I am "in the widget"? Thanks.
 
Last edited:
You have to use the public methods, like $xf.request.getServer. It should work the same in widgets as anywhere else.
 
Thanks, really ! It works exactly as expected. I do not know what happened before. I have now installed a local server setup so I can understand more how xenForo works. Thanks again !
 
Top Bottom