php 新闻文页当前页。

[复制链接]
查看11 | 回复2 | 2010-8-25 16:13:08 | 显示全部楼层 |阅读模式
function generatehtm($newsid){
global $ObjectMyClass; //在session_start();下面把它实例化
$sql= "select * from f_news where newsid=$newsid";
$result=$ObjectMyClass->query($sql);
$row=mysql_fetch_assoc($result);
$fp = fopen ("static.html","r"); //只读方式打开 static.html模板,将文件指针指向文件头
$tempLate= fread ($fp,filesize ("static.html")); //读取整个文件内容
$tempLate = str_replace("{title}",$row["title"],$tempLate);
$tempLate = str_replace("{keywords}",$row["keywords"],$tempLate);
$tempLate = str_replace("{Description}",$row["Description"],$tempLate);
$tempLate = str_replace("{time}",formatdate(1,$row["updatetime"]),$tempLate);
$tempLate = str_replace("{source}",$row["source"],$tempLate);
$tempLate = str_replace("{newsid}",$row["newsid"],$tempLate);
$tmpBody = $row["text"];
$tmpArray = PageNews($tmpBody);//保存到一个数组再生成分页地址,然后再由根据explode分的数组的内容生成htm 页面
$total = count($tmpArray);
if( $total >1 ){
$tmpStr = '';
for( $i=0;$i'.$str.'';
$tempLate = str_replace('{page}',$str,$tempLate);
for( $j=0;$j<$total;$j++ ){
if( $j==0 ){

$fname =$newsid.'.htm';
}else{

$fname =$newsid.'_'.$j.'.htm';
}
$tempMu = str_replace('{htmlContent}',$tmpArray[$j],$tempLate);
makeHtml($tempMu,$fname,"");
}
$mupage =1;
}
}
//创建文件
function makeHtml($tempMu,$file,$fname){
$filePath = 'html/'.date('Ymd');
if (!file_exists($filePath)){
createFolder($filePath);
}
$fp = fopen($filePath.'/'.$file, "w");
fwrite($fp,$tempMu);
fclose($fp);
}
function createFolder($path){
if (!file_exists($path)){
createFolder(dirname($path));
mkdir($path, 0777);
}
}
第一页为 1〔2〕〔3〕〔4〕
第二页为 〔1〕2〔3〕〔4〕
第三页为 〔1〕〔2〕3〔4〕
第四页为 〔1〕〔2〕〔3〕4
大哥大姐,小弟在这里救助各位大侠了,请问要怎么写能实现呀
css和js不能控制到吧。 大侠可以说得清楚一些,嘿。。 可以举例说明一下吗?
这个问题被弄得头好大。

回复

使用道具 举报

千问 | 2010-8-25 16:13:08 | 显示全部楼层
是得CSS
回复

使用道具 举报

千问 | 2010-8-25 16:13:08 | 显示全部楼层
分页写好之后 最终的效果用CSS或者JS控制就完了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行