您好,登錄后才能下訂單哦!
1.php超長文本分頁.運用自定義函數(shù)unhtml
代碼:
<?php
if ($page=="") {$page=1;}; //判斷變量的值是否為空
include("function.php"); //調(diào)用指定的包含文件,即自定義函數(shù)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>codego.net</title>
</head>
<body>
<table width="750" height="174" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="35" align="center"> </td>
<td width="100%" height="27" align="center"><strong>codego.net</strong></td>
<td width="35" align="center"> </td>
</tr>
<tr>
<td align="left" valign="middle"> </td>
<td height="60" align="left" valign="middle"><table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<?php
if($page){
$counter=file_get_contents("file/file.txt");
$length=strlen(unhtml($counter));
$page_count=ceil($length/1050);
$c=msubstr($counter,0,($page-1)*1050);
$c1=msubstr($counter,0,$page*1050);
echo substr($c1,strlen($c),strlen($c1)-strlen($c));
}?>
</td>
</tr>
</table></td>
<td align="left" valign="middle"> </td>
</tr>
</table>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="42%" align="center" valign="middle" bgcolor="#FFFFFF"><span class="STYLE1"> 頁次:<?php echo $page;?> / <?php echo $page_count;?> 頁 </span></td>
<td width="58%" height="28" align="left" valign="middle" bgcolor="#FFFFFF"><span class="STYLE1"> 分頁:
<?php
if($page!=1){
echo "<a href=index.php?lmbs=codego.net&page=1>首頁</a> ";
echo "<a href=index.php?lmbs=codego.net&page=".($page-1).">上一頁</a> ";
}
if($page<$page_count){
echo "<a href=index.php?lmbs=codego.net&page=".($page+1).">下一頁</a> ";
echo "<a href=index.php?lmbs=codego.net&page=".$page_count.">尾頁</a>";
}
?>
</span> </td>
</tr>
</table>
</body>
</html>
__________________________________________________________________________________________
2.Ajax無刷新分頁
代碼:
<?php if ($page=="") {$page=1;}; include("function.php");?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>codego.net</title>
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
color: #000000;
}
-->
</style></head>
<script type="text/javascript" src="js/discuss_js.js"></script>
<body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="360"><table width="350" height="300" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="70" bgcolor="#C0C0C0"><div align="right">
<input type="button" onClick="javascript:document.rp1.setfullscreen()" class="buttoncss" value="全屏播放"></div></td>
<td width="70" bgcolor="#C0C0C0"><input name="button" type="button" class="buttoncss" onClick="javascript:window.close()" value="關(guān)閉視窗"></td>
</tr>
<tr>
<td height="300" colspan="4" bgcolor="#ffffff"><div align="center">
<object onerror=alert("你的電腦中沒有安裝Realplayer播放器,請先安裝!") classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" name="rp1" width="350" height="300" id="rp1">
<param name="_extentx" value="12000">
<param name="_extenty" value="7500">
<param name="shuffle" value="0">
<param name="nolabels" value="0">
<param name="autostart" value="-1">
<param name="prefetch" value="0">
<param name="controls" value="p_w_picpathwindow">
<param name="console" value="clip1">
<param name="loop" value="0">
<param name="numloop" value="0">
<param name="center" value="0">
<param name="maintainaspect" value="0">
<param name="backgroundcolor" value="#000000">
<param name="src" value="rtsp://192.168.1.59/MR/21/sss.avi">
</object>
</div></td>
</tr>
<tr>
<td height="60" colspan="2" bgcolor="#000000"><div align="center">
<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" name="rp2" width="350" height="60" id="rp2">
<param name="_extentx" value="12000">
<param name="_extenty" value="1500">
<param name="shuffle" value="0">
<param name="nolabels" value="0">
<param name="autostart" value="-1">
<param name="prefetch" value="0">
<param name="controls" value="controlpanel,statusbar">
<param name="console" value="clip1">
<param name="loop" value="0">
<param name="numloop" value="0">
<param name="center" value="0">
<param name="maintainaspect" value="0">
<param name="backgroundcolor" value="#000000">
</object>
</div></td>
</tr>
</table></td>
<td width="440" align="center" valign="top">
<div id="synopsis"><!--創(chuàng)建div標簽,用于獲取js文件中返回的分頁結(jié)果-->
<table width="425" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20"> </td>
</tr>
<tr>
<td>
<?php
//讀取超長文本中的數(shù)據(jù),實現(xiàn)超長文本中數(shù)據(jù)的分頁顯示
if($page){
$counter=file_get_contents("file/mr_synopsis.txt");
$length=strlen($counter);
$page_count=ceil($length/950);
$c=msubstr($counter,0,($page-1)*950);
$c1=msubstr($counter,0,$page*950);
echo substr($c1,strlen($c),strlen($c1)-strlen($c));
}
?> </td>
</tr>
<tr>
<td>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr><!--設(shè)置超長文本分頁顯示的超級連接-->
<td width="42%" align="center" valign="middle" bgcolor="#FFFFFF"><span class="STYLE1"> 頁次:<?php echo $page;?> / <?php echo $page_count;?> 頁 </span></td>
<td width="58%" height="28" align="left" valign="middle" bgcolor="#FFFFFF"><span class="STYLE1"> 分頁:
<?php
if($page!=1){
?>
<!--調(diào)用artpagination函數(shù),實現(xiàn)無刷新的分頁輸出-->
<a href="#" artpagination("mr_synopsis_ok.php?page=1")'>首頁</a>
<a href="#" artpagination("mr_synopsis_ok.php?&page=<?php echo $page-1;?>")'>上一頁</a>
<?php }
if($page<$page_count){
?>
<a href="#" artpagination("mr_synopsis_ok.php?page=<?php echo $page+1;?>")'>下一頁</a>
<a href="#" artpagination("mr_synopsis_ok.php?page=<?php echo $page_count;?>")'>尾頁</a>
<?php
}
?>
</span> </td>
</tr>
</table></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。