Code này có tác dụng dếm ngược thời gian online giống fb nhé
TWIG
{%set now="now"|date("U")%} {%set this=api.u.get(api.user_id).loged%} {%set show=now-this|date("U")%} {%if show<60%} {%set time="Vừa xong"%} {%elseif show>=60 and show<3600%} {%set time="Cách đây "~(show/60)|split('.')[0]~" phút "~(show-(show/60)|split('.')[0]*60)~" giây"%} {%elseif show>=3600 and show<3600*24%} {%set time="Cách đây "~(show/60/60)|split('.')[0]~" giờ "~((show-((show/60/60)|split('.')[0]*3600))/60)|split('.')[0]~" phút trước"%} {%else%} {%if (show/60/60/24)|split('.')[0]==1%} {%set time="Hôm qua, lúc "~this|date("H:i")%} {%else%} {%set time="Cách đây "~(show/60/60/24)|split('.')[0]~" ngày"%} {%endif%} {%endif%}
Thêm code này vào nơi muốn hiện
TWIG
{{time}}
![[OFF]](/assets/images/off.gif)