Ai fix giúp vs! Ths. Lỗi if get_get('act') == 'edit' nằm trong if cmt ko hoạt động
TWIG
{% if login %} {% set cmt = get_post( 'comment' ) %} {% set id = get_get('id') %} {% set key2 = get_data_by_id(get('user_'~tk,'id')~'chat_ver',id).data|json_decode %} {% set cs = key2.comment %} {% set name = key2.name %} {% set tg= key2.time %} <div class="gmenu"> <form method="post" action="/profile{% if login != tk %}/{{tk}}{% endif %}"> Nội dung:<br /> <textarea type= "text" name="comment">{% if get_get('act') == 'edit' %}{{cs}}{% endif %}</textarea><br /> <button type="submit"> Lưu </button> </form></div> {% if get_get('act') == 'xoa' %} {{delete_data_by_id(get('user_'~tk,'id')~'chat_ver',id)}} <div class="menu">Xong rồi nhé!!!</div> <script>window.location.href='/profile{% if login != tk %}/{{tk}}{% endif %}'</script> {% endif %} {% if request_method()|lower == "post" %} {% if cmt %} {% if get_get('act') == 'edit' %} {% set nd = {"name":name,"time":tg,"comment":cmt}|json_encode %} {{update_data_by_id(get('user_'~tk,'id')~'chat_ver',id,nd)}} <div class="menu">Xong rồi nhé!!!</div> <script>window.location.href='/profile{% if login != tk %}/{{tk}}{% endif %}'</script> {% else %} {% if login != tk %} {% set tn=get('user_'~tk,'tuongnha')|trim %} {{ add('user_'~tk,'tuongnha',tn|trim+1) }} {% endif %} {% set comment = {"name" :login,"time":"now"|date('U'), "comment":cmt} %} {% set status = save_data( taolap~"chat_ver", comment|json_encode ) %} <script>window.location.href='/profile{% if login != tk %}/{{tk}}{% endif %}'</script> {% endif %} {% endif %} {% endif %}