XF 2.1 Сheck $_SERVER["HTTP_USER_AGENT"] on template

John rus

Member
Hello all !
How i can check $_SERVER["HTTP_USER_AGENT"] on template ?
Make condition like
Code:
<xf:if is="{$xf.user_agent} == 'firefox'">
.......
</xf:if>

???
 
 
HTML:
<xf:if is="contains($xf.request.getUserAgent(), 'firefox')">
    <!-- ... ->
</xf:if>

I'm not joking, I was searching for HOURS trying to figure out how I could modify a template based on something, anything, I could put in the link on the referring page. This was just enough of a hint to make me look at Request.php (I don't know PHP) and see that I could use $xf.request.getRequestUri() along with your code to change the template based on a URL variable. I'm sure there's a better or more 'right' way to do it, but this seems to be working, so THANK YOU :)
 
Back
Top Bottom