MinhNP
(Member)
[Off] 29-09-2016 |
Có nghe mấy chế dùng fl tsukuyomi nói là phân trang đang dùng bị lỗi nên mình sửa lại cái phân trang cho mấy chế dùng đây, mang về dán vào page.xt nha
#exportable
function page $noidung=;$show=5000;$url=<xt:url type="path" />;
get p
var $dv = <tx:get_device_template />
if $dv==web
var $show=($show*2)
endif
if $p==
var $p=1
endif
if $p==1
var $batdau=0
else
var $batdau=($p*$show-$show)
endif
var $lnd = call strlen $val=$noidung
var $nump =($lnd/$show)
var $nump = call ceil $num=$nump
var $textd = call substr $val=$noidung;$start=$batdau;$length=$show
var $st = call strpos $haystack=$textd;$needle=<br />
var $textc = call substr $val=$noidung;$start=($batdau+$show);$length=($show+10)
var $et = call strpos $haystack=$textc;$needle=<br />
if $p==1
var $st=0
endif
if $p==$nump
var $et=0
endif
var $pupy = call substr $val=$noidung;$start=($batdau+$st);$length=($show+$et-$st)
/* Puppy */
print $pupy
// nut phan trang
if $nump > 1
print <div class="topmenu">
endif
if $nump > 1
//
if $p > 1
print <a class="pagenav" href="$url?p=($p-1)">«</a>
endif
if $p > 1
print <a class="pagenav" href="$url?p=1">1</a>
endif
if $p > 4
print <a href="#" class="pagenav">...</a>
endif
if $p > 3
print <a class="pagenav" href="$url?p=($p-2)">($p-2)</a>
endif
if $p > 2
print <a class="pagenav" href="$url?p=($p-1)">($p-1)</a>
endif
if $nump > 1
print <span class="currentpage" style="color:red"><b>$p</b></span>
endif
if $p < ($nump-1)
print <a class="pagenav" href="$url?p=($p+1)">($p+1)</a>
endif
if $p < ($nump-2)
print <a class="pagenav" href="$url?p=($p+2)">($p+2)</a>
endif
if $p < ($nump-3)
print <a href="#" class="pagenav">...</a>
endif
if $p < $nump
print <a class="pagenav" href="$url?p=$nump">$nump</a>
endif
if $p < $nump
print <a class="pagenav" href="$url?p=($p+1)">»</a>
endif
//
endif
if $nump > 1
print </div>
endif
endfunction
function page $noidung=;$show=5000;$url=<xt:url type="path" />;
get p
var $dv = <tx:get_device_template />
if $dv==web
var $show=($show*2)
endif
if $p==
var $p=1
endif
if $p==1
var $batdau=0
else
var $batdau=($p*$show-$show)
endif
var $lnd = call strlen $val=$noidung
var $nump =($lnd/$show)
var $nump = call ceil $num=$nump
var $textd = call substr $val=$noidung;$start=$batdau;$length=$show
var $st = call strpos $haystack=$textd;$needle=<br />
var $textc = call substr $val=$noidung;$start=($batdau+$show);$length=($show+10)
var $et = call strpos $haystack=$textc;$needle=<br />
if $p==1
var $st=0
endif
if $p==$nump
var $et=0
endif
var $pupy = call substr $val=$noidung;$start=($batdau+$st);$length=($show+$et-$st)
/* Puppy */
print $pupy
// nut phan trang
if $nump > 1
print <div class="topmenu">
endif
if $nump > 1
//
if $p > 1
print <a class="pagenav" href="$url?p=($p-1)">«</a>
endif
if $p > 1
print <a class="pagenav" href="$url?p=1">1</a>
endif
if $p > 4
print <a href="#" class="pagenav">...</a>
endif
if $p > 3
print <a class="pagenav" href="$url?p=($p-2)">($p-2)</a>
endif
if $p > 2
print <a class="pagenav" href="$url?p=($p-1)">($p-1)</a>
endif
if $nump > 1
print <span class="currentpage" style="color:red"><b>$p</b></span>
endif
if $p < ($nump-1)
print <a class="pagenav" href="$url?p=($p+1)">($p+1)</a>
endif
if $p < ($nump-2)
print <a class="pagenav" href="$url?p=($p+2)">($p+2)</a>
endif
if $p < ($nump-3)
print <a href="#" class="pagenav">...</a>
endif
if $p < $nump
print <a class="pagenav" href="$url?p=$nump">$nump</a>
endif
if $p < $nump
print <a class="pagenav" href="$url?p=($p+1)">»</a>
endif
//
endif
if $nump > 1
print </div>
endif
endfunction
Nguồn: pupy
Edited MinhNP
#9 (0) |