#exportable
function page $noidung=;$show=5000;
get id
var $url=http://mecungwap.hexat.com/capnhat/index.html&p
var $lnd = call strlen $val=$noidung
if $lnd <= $show
var $cut = $noidung
endif
if $lnd > $show
var $nump = ($lnd/$show)
var $nump = call ceil $num=$nump
get p
if $p ==
var $p=1
endif
if $p > $nump
var $p=$nump
endif
var $batdau =($p*$show-$show)
var $cut = call substr $val=$noidung;$start=$batdau;$length=$show;
if $p > 1
var $dau =
1
var $prev =
<<
if $p > 2
var $prevp =
($p-1)
if $p > 3
var $prevvp =
($p-2)
if $p > 4
var $dau =
1 ...
endif
endif
endif
endif
if $p < $nump
var $next =
>>
var $cuoi =
$nump
if $p < ($nump-1)
var $nextp =
($p+1)
if $p < ($nump-2)
var $nexttp =
($p+2)
if $p < ($nump-3)
var $cuoi = ...
$nump
endif
endif
endif
endif
print $cut
var $page = $prev $dau $prevvp $prevp
$p $nextp $nexttp $cuoi $next
var $page = call str_replace $subject=$page; $search=...; $replace= ...
if $lnd > $show
print
endif
endfunction