15/05/24
Share code ngày đăng mới nhất chuẩn 99.9%. Dạng hôm nay, hôm qua và ngày trước
Trước tiên là code hiện thời gian.
Demo: FORLAM
Share code ngày đăng mới nhất chuẩn 99.9%. Dạng hôm nay, hôm qua và ngày trước
~sdate~.file_date.~edate~
Dán code trên vào chỗ muốn hiện thời gian.
Sau đó là chèn code này vào dưới hàng @batdau
/* Ngay gio dang bai */
assign $edate=call strrpos $haystack=$list;$needle=~edate~; $offset=0
assign $sdate=call strrpos $haystack=$list;$needle=~sdate~; $offset=0
var $getdate = call substr $val=$list;$start=($sdate+7);$length=($edate-$sdate-7);
var $nam = call substr $val=$getdate;$start=0;$length=4;
var $thang = call substr $val=$getdate;$start=5;$length=2;
var $ngay= call substr $val=$getdate;$start=-2;$length=2;
var $tnam = <xt:tdate format="Y" tzone="7"/>
var $tthang = <xt:tdate format="m" tzone="7"/>
var $tngay = <xt:tdate format="d" tzone="7"/>
if $tngay < 10
var $ngayt = call substr $val=$tngay;$start=-1;$length=1;
var $ngayt = 0($tngay-1)
else
var $ngayt = ($tngay-1)
endif
if $getdate == $tnam-$tthang-$tngay
var $dang = Hôm nay <img src="http://forlam.wap.sh/images/icon/hot.gif" alt="hot"/>
elseif $getdate == $tnam-$tthang-$ngayt
var $dang = Hôm qua <img src="http://forlam.wap.sh/images/icon/new_fl.gif" alt="new"/>
else
var $dang = <xt id="countdown" format="days" from="$getdate" to="now" > ngày trước
endif
var $list = call str_replace $subject=$list;$search=~sdate~$getdate~edate~;$replace=$dang;
Xong rồi đấy. Chúc bạn thành công !