soeasy.就是根据标题查找内容是把。我不知道你会到什么程度啊,会连接数据库吧??phpinclude\"page.php\";//分页类//这个是list2,php//连接数据库省略了$title=$_GEt[\'title\'];$msgcount=mysql_query(\"selectcount(*)fromnewswheretitle=‘$title’\");$page=$_GEt[\'page\'];下面我写分页的。$pagesize=\"4\";$startnum=($page-1)*$pagesize;//写到这里也不知道你会不会smarty。。。。$pagestring=newPage($page,$pagesize,$msgcount,\"url这个是你的php文件地址\");$result=mysql_query(\"select*fromnewswheretitle=‘$title’limit\'$startnum,$pagesize\'\");$this-smarty-assign(\"pagestaring\",$pagestaring);$this-smarty-assign(\"result\",$result);$this-smarty-display(\"你的模版//xxxx.html\");ok了。分页类我给你:?phpclassPage{staticfunctionpager($page,$msg_count,$pagesize,$url=\'?\'){//计算总页数$page_count=ceil($msg_count/$pagesize);//下一页的页码$nextpage=$page1;//上一页的页码$lastpage=$page-1;if($page$page_count){$page=$page_count;}//定义分页字符串$pagestring=\'\';$pagestring.=\"总数:$msg_count页数:$page/$page_countahref=\'$url\".\"首页/a\";if($page1){$pagestring.=\"ahref=\'$url\".\"上页/a\";}else{$pagestring.=\"ahref=\'#\'上页/a\";}if($page5){$startpage=1;}if($page=5($page_count-5)){$startpage=$page-4;}if($page=($page_count-5)5){$startpage=$page_count-9;}if($page_count=10){$startpage=1;}if($page5){if($page_count=10)$endpage=10;else$endpage=$page_count;}if($page=($page_count-5))$endpage=$page_count;if($page=5($page_count-5))$endpage=$page5;for($i=$startpage;$i=$endpage;$i){if($page==$i)$pagestring.=\"ahref=\'#\'class=\'thispage\'$i/a\";else$pagestring.=\"ahref=\'$url\".\"$i/a\";}if($page$page_count){$pagestring.=\"ahref=\'$url\".\"下页/a\";}else{$pagestring.=\"ahref=\'#\'下页/a\";}$pagestring.=\"ahref=\'$url\".\"末页/a\";return$pagestring;}}?完成了。。。。。。很辛苦呀。好好学习吧,php的学习要多看源码的!?追问好的先谢谢等下我测试一下看看行吗$this-smarty-display(\"你的模版//xxxx.html\");这个是什么意思,模板????谢谢还是不行我已经又补充好问题啦,链接数据库已经在top里面希望能更详细些
|