XF 2.0 Math functions in XF2 templates?

murdercode

Active member
#1
Hi,
I would replicate this structure URL: <img src="/forum/data/avatars/s/_GROUP_/{$user.user_id}.jpg?{$user.avatar_date}">

As I can see, _GROUP_ can be calculated with this method:

_GROUP_ = floor -> {$user.user_id} / 1000
(ya, this isn't PHP code, I haven't source in front of)

So, the question is: there's a way to use simply math functions in XF2 templates (without scripting it in PHP)?
 

Chris D

XenForo developer
Staff member
#2
We don't expose everything, but we do actually expose floor (and ceil), so this should work:
Code:
<img src="/forum/data/avatars/s/{{ floor($user.user_id / 1000) }}/{$user.user_id}.jpg?{$user.avatar_date}">
 
Top