* tiaxgame * Graham Countdown of my
time languishing
occasionally, do not
fix it. 'guestbook'
{% set s=comment.date|slice(17,2) %}
      {% set m=comment.date|slice(14,2) %}
      {% set h=comment.date|slice(11,2) %}
      {% set d=comment.date|slice(8,2) %}
      {% set day=comment.date|slice(8,2) %}
      {% set mo=comment.date|slice(5,2) %}
      {% set y=comment.date|slice(0,4) %}
      {% set time1=comment.date|slice(11,8) %}
      {% set nowm="now"|date("s", "Asia/Ho_Chi_Minh") %}
      {% if s <= "now"|date("s", "Asia/Ho_Chi_Minh")  %}
      {% set s="now"|date("s", "Asia/Ho_Chi_Minh")-s %}
      {% else %}
      {% set s,m="now"|date("s", "Asia/Ho_Chi_Minh")+60-s,m+1 %}{%endif%}
      
      {% if m <= "now"|date("i", "Asia/Ho_Chi_Minh")  %}
      {% set m="now"|date("i", "Asia/Ho_Chi_Minh")-m %}
      {% else %}
      {% set m,h="now"|date("i", "Asia/Ho_Chi_Minh")+60-m,h+1 %}{%endif%}
     
      {% if h <= "now"|date("H", "Asia/Ho_Chi_Minh")  %}
      {% set h="now"|date("H", "Asia/Ho_Chi_Minh")-h %}
      {% else %}
      {% set h,d="now"|date("H", "Asia/Ho_Chi_Minh")+24-h,d+1 %}{%endif%}
      
      {% if d <= "now"|date("d", "Asia/Ho_Chi_Minh")  %}
      {% set d="now"|date("d", "Asia/Ho_Chi_Minh")-d+1 %}
      {% else %}
      {% set d,mo="now"|date("d", "Asia/Ho_Chi_Minh")+31-d,1 %}{%endif%}
      
      {% if mo < nowm %}
      {% if day=="now"|date("d", "Asia/Ho_Chi_Minh") %}
      {% if h > 0%}{% set time %}{{ h}} giờ,<br /> {{m~" phút" }} trước{% endset %}{%elseif h==0 and m > 0%}{% set time %}{{m}} phút,<br/> {{s}} giây trước{% endset %}{%else%}{% set time %}Vừa xong{% endset %}{%endif%}
      {%elseif d<=1 %}{% set time %}Hôm qua,<br />- Lúc {{time1}} {% endset %}{%elseif d > 1 %}{% set time %}{{ d }} ngày trước,<br />- Lúc {{time1}}{% endset %}{% endif %}{%else%}{% set time %}{{comment.date}}{% endset %}
{% endif %}
{{time|raw}}

Copy code
2014-06-02 13:58 · (0)
* Graham * tiaxgame I do not think twig has those functions
2014-05-31 02:57 · (0)
* tiaxgame * Graham Ok.
I want to used 'encode' and 'decode' of "base64"
, "chr", "sha1", ... etc.
2014-05-31 02:40 · (0)
* Graham * tiaxgame I just tested
{% set a="2" %}
{{a+1}}
and the output is 3
2014-05-29 23:55 · (0)
* tiaxgame * Graham i want to change 'string' -> "number"
{% set a="2" %}
{{a+1}}
I want: output = 3 (the number)
2014-05-29 22:54 · (0)
* tiaxgame * Graham Ok, thanks. Now, I
have problems with
paging. I have the
current page {{p}}
and {{laughter}}
pend. Please write
classified as paging
forums
2014-05-28 18:28 · (0)
* Graham * tiaxgame in a way it is a lot simpler than xtscript :)
{% for i in 0..10 %}
    * {{ i }}
{% endfor %}

Copy code

http://twig.sensiolabs.org/doc/tags/for.html
2014-05-28 02:30 · (0)
* tiaxgame * Graham I want creat a "loop" with tag 'for' as 'xtscript'
But i'm not know,
{% set i=0 %}
{% for ??? %}
{% set i %>{{i+1}}{% endset %}
{{i}}
If i>10
Stop
Endif
Endfor
2014-05-28 01:55 · (0)
* tiaxgame * Graham ok!
2014-05-28 01:48 · (0)
* Graham * tiaxgame That code already works the output is "b" !
or do you want to output it like "b[1]"
{{data[i]}}[{{i}}]
or "b[i]"
{{data[i]}}[i]
2014-05-27 23:30 (edited 2014-05-28 01:46 by Graham ) · (0)

Online: Guests: 1