• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Share xtscript phân trang không lỗi

Admin

Well-Known Member
Staff member
Administrator
Đây là code phân trang của mình. Phân cách theo thẻ br nên bạn không lo lỗi kí tự như thế này: Code ph..
Hay lỗi thẻ hình ảnh.
Dành cho người thích chế filelist :)
ai đang dùng filelist có chức năng phân trang thì thay nội dung file page.xt bằng code dưới:
HTML:
#exportable
function page $noidung=;$show=6000;$url=?p;
get p
var $dv = <xt:get_device_template />
if $dv==web
var $show=($show*5)
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 $cut = call substr $val=$noidung;$start=($batdau+$st);$length=($show+$et-$st)
/* hello */
print <p>$cut</p>
if $p!=1
var $dau = <a href="$url=1">1</a>,
var $prev = <a href="$url=($p-1)">[<]</a>
if $p != 2
var $prevp = <a href="$url=($p-1)">($p-1)</a>,
endif
if $p > 3
var $prevvp = <a href="$url=($p-2)">($p-2)</a>,
endif
endif
if $p!=$nump 
var $cuoi = ,<a href="$url=$nump">$nump</a>
if $p != ($nump-1)
var $nextp = ,<a href="$url=($p+1)">($p+1)</a>
var $next = <a href="$url=($p+1)">[>]</a>
endif 
if $p<($nump-2)
var $nexttp = ,<a href="$url=($p+2)">($p+2)</a>
endif
endif
if $nump >1
print <div class="sub">Trang: $prev $dau$prevvp$prevp[$p]$nextp$nexttp$cuoi $next</div>
endif
endfunction
Còn đây là cách dùng hàm
HTML:
include page.xt #duong dan den file page.xt
call @page $noidung=Nội dung cần phân trang;$show=Số kí tự trên 1 trang(xấp xỉ);$url=url-hien-tai?p
 

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top