您好,欢迎来到点滴吧! 手机版
点滴吧www.diandiba.com
记录点点滴滴,尽在点滴吧
  • 文章
  • 文章
  • 特效
  • 素材
  • 景点
您现在的位置:首页 > 动易 > 文章正文
SiteWeaver个别频道二次开发后实现静态化生成
更新时间:2015/1/5 22:45:33   点击:3736次

一、修改点击生成的链接页面:

1.打开/Admin/Admin_Article.asp文件

2.找到:

Response.Write "<a href='Admin_CreateArticle.asp?ChannelID=" & ChannelID & "&Action=CreateArticle&ArticleID=" & rsArticleList("ArticleID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"

改为:

If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
Response.Write "<a href='Admin_CreateHtml_Content.asp?ChannelID=" & ChannelID & "&ArticleID=" & rsArticleList("ArticleID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"
Else
Response.Write "<a href='Admin_CreateArticle.asp?ChannelID=" & ChannelID & "&Action=CreateArticle&ArticleID=" & rsArticleList("ArticleID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"
End If


3.找到:

                    Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='1';document.myform.action='Admin_CreateArticle.asp';"" value='生成当前栏目列表页'>&nbsp;&nbsp;"
                End If
                If ClassPurview = 0 Then
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateArticle';document.myform.CreateType.value='2';document.myform.action='Admin_CreateArticle.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
                End If
            Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateIndex';document.myform.CreateType.value='1';document.myform.action='Admin_CreateArticle.asp';"" value='生成首页'>&nbsp;&nbsp;"
                If UseCreateHTML = 1 Or UseCreateHTML = 3 Then
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='2';document.myform.action='Admin_CreateArticle.asp';"" value='生成所有栏目列表页'>&nbsp;&nbsp;"
                End If
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateArticle';document.myform.CreateType.value='3';document.myform.action='Admin_CreateArticle.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
            End If
Response.Write "<input name='submit2' type='submit' id='submit2' onClick=""document.myform.Action.value='CreateArticle';document.myform.action='Admin_CreateArticle.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"

改为:

   If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_List.asp';"" value='生成当前栏目列表页'>&nbsp;&nbsp;"
Else
                    Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='1';document.myform.action='Admin_CreateArticle.asp';"" value='生成当前栏目列表页'>&nbsp;&nbsp;"
End If
                End If
                If ClassPurview = 0 Then
    If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
                    Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_Content.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateArticle';document.myform.CreateType.value='2';document.myform.action='Admin_CreateArticle.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
End If
                End If
            Else
    If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_Index.asp';"" value='生成首页'>&nbsp;&nbsp;"             
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateIndex';document.myform.CreateType.value='1';document.myform.action='Admin_CreateArticle.asp';"" value='生成首页'>&nbsp;&nbsp;"
End If
                If UseCreateHTML = 1 Or UseCreateHTML = 3 Then
    If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_List.asp';"" value='生成所有栏目列表页'>&nbsp;&nbsp;"                    
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='2';document.myform.action='Admin_CreateArticle.asp';"" value='生成所有栏目列表页'>&nbsp;&nbsp;"
End If
                End If
If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
                Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_Content.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateArticle';document.myform.CreateType.value='3';document.myform.action='Admin_CreateArticle.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
End If
            End If
If ChannelID=1001 or ChannelID=1006 or ChannelID=1010 or ChannelID=1013 then
            Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreateHtml_Content.asp';""  value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
Else
Response.Write "<input name='submit2' type='submit' id='submit2' onClick=""document.myform.Action.value='CreateArticle';document.myform.action='Admin_CreateArticle.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
End If


二、生成频道首页:Admin_CreateHtml_Index.asp

<!--#include virtual="Conn/conn.asp"--> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

body{margin:10px 0px 0px 0px;padding:0;font-size:12px;line-height:19px;}


a:link{text-decoration:none;color:#000000;}

a:visited{text-decoration:none;color:#000000;}

a:hover{text-decoration:none;color:#FF6600;}

a:active{text-decoration:none;color:#000000;}


ul{margin:0px; padding:0px;}

li{padding-left:15px;}

</style>

</head>


<body>

<%

ChannelID=request("ChannelID")

ClassID=request("ClassID")


'查询频道信息

set ChannelRs=server.CreateObject("adodb.recordset")

ChannelSql="select ChannelShortName,ChannelItemUnit,ChannelDir from PE_Channel where ChannelID="&ChannelID

ChannelRs.open ChannelSql,conn,3,2

%>

<strong>正在生成此频道的首页</strong>

<%

FileName = "Index.html"

FilePath = Server.MapPath("/"&ChannelRs("ChannelDir")&"/")&"\"&FileName

Do_Url = "http://"

Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&ChannelRs("ChannelDir")&"/Index.asp"

Do_Url = Do_Url&"?ClassID="&ClassID



strUrl = Do_Url

dim objXmlHttp

set objXmlHttp = Server.createObject("Microsoft.XMLHTTP")

objXmlHttp.open "GET",strUrl,false

objXmlHttp.send()

Dim binFileData

binFileData = objXmlHttp.responseBody

Dim objAdoStream

set objAdoStream = Server.createObject("ADODB.Stream")

objAdoStream.Type = 1

objAdoStream.Open()

objAdoStream.Write(binFileData)

objAdoStream.SaveToFile FilePath,2

objAdoStream.Close()

%>

<strong>(<a href="/<%=ChannelRs("ChannelDir")%>/<%=FileName%>" target="_blank">/<%=ChannelRs("ChannelDir")%>/<%=FileName%></a>)…………………………生成首页成功!</strong>

<div style="line-height:30px;">

已经生成所有页面!<br />

<a href="Admin_Article.asp?ChannelID=<%=ChannelID%>&Action=Manage&Status=3&ManageType=HTML">【返回】

</a></div>

</body>

</html>


三、生成栏目列表页:

<!--#include virtual="Conn/conn.asp"-->

<!--#include virtual="Conn/inc.asp"--> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

body{margin:10px 0px 0px 0px;padding:0;font-size:12px;line-height:19px;}


a:link{text-decoration:none;color:#000000;}

a:visited{text-decoration:none;color:#000000;}

a:hover{text-decoration:none;color:#FF6600;}

a:active{text-decoration:none;color:#000000;}


ul{margin:0px; padding:0px;}

li{padding-left:15px;}

.fenye{padding-left:30px;}

</style>

</head>


<body>

<%

ChannelID=request("ChannelID")

ClassID=request("ClassID")


if ClassID<>0 then

IfClassID=" and ClassID in ("&ClassID&")"

end if


'查询频道信息

set ChannelRs=server.CreateObject("adodb.recordset")

ChannelSql="select ChannelShortName,ChannelItemUnit,ChannelDir from PE_Channel where ChannelID="&ChannelID

ChannelRs.open ChannelSql,conn,3,2


'查询要生成的栏目

set ClassIDRs=server.CreateObject("adodb.recordset")

ClassIDSql="select ClassID from PE_Class where ChannelID="&ChannelID&IfClassID&" order by ClassID asc"

ClassIDRs.open ClassIDSql,conn,3,2


'获取列表页每页显示数量

if ChannelID=1001 then

ShowNum=11

elseif ChannelID=1006 then

ShowNum=20

elseif ChannelID=1013 then

ShowNum=20

end if


%>

<strong>正在生成列表页面……请稍候!<span style="color:#FF0000;">在此过程中请勿刷新此页面!!!</span></strong><br />

总共需要生成 <strong style="color:#FF0000;"><%=ClassIDRs.recordcount%></strong> 个栏目

<UL>

<%

i=1

do while not ClassIDRs.eof

ClassID = ClassIDRs("ClassID")


'查询要生成栏目的分页数量

set ArticleRs=server.CreateObject("adodb.recordset")

ArticleSql="select ArticleID from PE_Article where ClassID in ("&GetClassChildID(ClassID)&")"

ArticleRs.open ArticleSql,conn,3,2

PageNum=ArticleRs.recordcount/ShowNum

PageNumArr=split(PageNum,".")

if ubound(PageNumArr)>0 then

PageNum=Int(PageNum)+1

end if


FileName = "List_"&ClassID&".html"

FilePath = Server.MapPath("/"&ChannelRs("ChannelDir")&"/")&"\"&FileName

Do_Url = "http://"

Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&ChannelRs("ChannelDir")&"/ShowClass.asp"

Do_Url = Do_Url&"?ClassID="&ClassID



strUrl = Do_Url

dim objXmlHttp

set objXmlHttp = Server.createObject("Microsoft.XMLHTTP")

objXmlHttp.open "GET",strUrl,false

objXmlHttp.send()

Dim binFileData

binFileData = objXmlHttp.responseBody

Dim objAdoStream

set objAdoStream = Server.createObject("ADODB.Stream")

objAdoStream.Type = 1

objAdoStream.Open()

objAdoStream.Write(binFileData)

objAdoStream.SaveToFile FilePath,2

objAdoStream.Close()

%>


<li>成功生成 第 <strong style="color:#FF0000;"><%=i%></strong> 个栏目的列表:<a href="/<%=ChannelRs("ChannelDir")%>/<%=FileName%>" target="_blank">/<%=ChannelRs("ChannelDir")%>/<%=FileName%></a></li>


<%

'生成分页

if PageNum>1 then

for j=2 to PageNum


FileNameF = "List_"&ClassID&"_"&j&".html"

FilePathF = Server.MapPath("/"&ChannelRs("ChannelDir")&"/")&"\"&FileNameF

Do_UrlF = "http://"

Do_UrlF = Do_UrlF&Request.ServerVariables("SERVER_NAME")&"/"&ChannelRs("ChannelDir")&"/ShowClass.asp"

Do_UrlF = Do_UrlF&"?ClassID="&ClassID&"&CurPage="&j



strUrlF = Do_UrlF

dim objXmlHttpF

set objXmlHttpF = Server.createObject("Microsoft.XMLHTTP")

objXmlHttpF.open "GET",strUrlF,false

objXmlHttpF.send()

Dim binFileDataF

binFileDataF = objXmlHttpF.responseBody

Dim objAdoStreamF

set objAdoStreamF = Server.createObject("ADODB.Stream")

objAdoStreamF.Type = 1

objAdoStreamF.Open()

objAdoStreamF.Write(binFileDataF)

objAdoStreamF.SaveToFile FilePathF,2

objAdoStreamF.Close()

%>

<li class="fenye">成功生成 第 <strong style="color:#FF0000;"><%=i%></strong> 个栏目的第 <span style="color:#0000FF;"><%=j%></span> 页列表:<a href="/<%=ChannelRs("ChannelDir")%>/<%=FileNameF%>" target="_blank">/<%=ChannelRs("ChannelDir")%>/<%=FileNameF%></a></li>

<%

next

end if

%>


<%

i=i+1

ClassIDRs.movenext

loop

ClassIDRs.close

set ClassIDRs=nothing

ChannelRs.close

set ChannelRs=nothing

%>

</UL>

<div style="line-height:30px;">

已经生成所有页面!<br />

<a href="Admin_Article.asp?ChannelID=<%=ChannelID%>&Action=Manage&Status=3&ManageType=HTML">【返回】

</a></div>

</body>

</html>


四、生成内容页:Admin_CreateHtml_Content.asp

<!--#include virtual="Conn/conn.asp"--> 

<!--#include virtual="Conn/inc.asp"--> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

body{margin:10px 0px 0px 0px;padding:0;font-size:12px;line-height:19px;}


a:link{text-decoration:none;color:#000000;}

a:visited{text-decoration:none;color:#000000;}

a:hover{text-decoration:none;color:#FF6600;}

a:active{text-decoration:none;color:#000000;}


ul{margin:0px; padding:0px;}

li{padding-left:15px;}

</style>

</head>


<body>

<%

ChannelID=request("ChannelID")

ClassID=request("ClassID")

ArticleID=request("ArticleID")


if ClassID<>0 then

IfClassID=" and ClassID in ("&GetClassChildID(ClassID)&")"

end if


if ArticleID<>"" then

IfArticleID=" and ArticleID in ("&ArticleID&")"

end if


'查询频道信息

set ChannelRs=server.CreateObject("adodb.recordset")

ChannelSql="select ChannelShortName,ChannelItemUnit,ChannelDir from PE_Channel where ChannelID="&ChannelID

ChannelRs.open ChannelSql,conn,3,2


'查询要生成的文章

set ArticleIDRs=server.CreateObject("adodb.recordset")

ArticleIDSql="select ArticleID,Title from PE_Article where ChannelID="&ChannelID&IfClassID&IfArticleID&" and Deleted=false order by ArticleID asc"

ArticleIDRs.open ArticleIDSql,conn,3,2

%>

<strong>正在生成内容页面……请稍候!<span style="color:#FF0000;">在此过程中请勿刷新此页面!!!</span></strong><br />

总共需要生成 <strong style="color:#FF0000;"><%=ArticleIDRs.recordcount%></strong> <%=ChannelRs("ChannelItemUnit")%><%=ChannelRs("ChannelShortName")%>

<UL>

<%

i=1

do while not ArticleIDRs.eof

ArticleID = ArticleIDRs("ArticleID")

FileName = ArticleID&".html"

FilePath = Server.MapPath("/"&ChannelRs("ChannelDir")&"/")&"\"&FileName

Do_Url = "http://"

Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&ChannelRs("ChannelDir")&"/ShowArticle.asp"

Do_Url = Do_Url&"?ArticleID="&ArticleID



strUrl = Do_Url

dim objXmlHttp

set objXmlHttp = Server.createObject("Microsoft.XMLHTTP")

objXmlHttp.open "GET",strUrl,false

objXmlHttp.send()

Dim binFileData

binFileData = objXmlHttp.responseBody

Dim objAdoStream

set objAdoStream = Server.createObject("ADODB.Stream")

objAdoStream.Type = 1

objAdoStream.Open()

objAdoStream.Write(binFileData)

objAdoStream.SaveToFile FilePath,2

objAdoStream.Close()

%>


<li>成功生成 第 <strong style="color:#FF0000;"><%=i%></strong> <%=ChannelRs("ChannelItemUnit")%><%=ChannelRs("ChannelShortName")%>。&nbsp;&nbsp;&nbsp;ID:<%=ArticleID%>&nbsp;&nbsp;&nbsp;标题:<%=ArticleIDRs("Title")%>&nbsp;&nbsp;&nbsp;地址:<a href="/<%=ChannelRs("ChannelDir")%>/<%=FileName%>" target="_blank">/<%=ChannelRs("ChannelDir")%>/<%=FileName%></a></li>


<%

i=i+1

ArticleIDRs.movenext

loop

ArticleIDRs.close

set ArticleIDRs=nothing

ChannelRs.close

set ChannelRs=nothing

%>

</UL>

<div style="line-height:30px;">

已经生成所有页面!<br />

<a href="Admin_Article.asp?ChannelID=<%=ChannelID%>&Action=Manage&Status=3&ManageType=HTML">【返回】

</a></div>

</body>

</html>


五、拓展:

个别图片频道二次开发后实现静态化:

1.修改点击生成的链接页面

<1>打开Admin/Admin_Photo.asp

<2>找到:

Response.Write "<a href='Admin_CreatePhoto.asp?ChannelID=" & ChannelID & "&Action=CreatePhoto&PhotoID=" & rsPhotoList("PhotoID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"

改为:

                    If ChannelID=1009 then
Response.Write "<a href='Admin_CreatePhoto_Content.asp?ChannelID=" & ChannelID & "&PhotoID=" & rsPhotoList("PhotoID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"
Else
Response.Write "<a href='Admin_CreatePhoto.asp?ChannelID=" & ChannelID & "&Action=CreatePhoto&PhotoID=" & rsPhotoList("PhotoID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"
End If

<3>找到:

Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreatePhoto';document.myform.CreateType.value='2';document.myform.action='Admin_CreatePhoto.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"

改为:

   If ChannelID=1009 then
                    Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreatePhoto_Content.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreatePhoto';document.myform.CreateType.value='2';document.myform.action='Admin_CreatePhoto.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
End If

<4>找到:

Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreatePhoto';document.myform.CreateType.value='3';document.myform.action='Admin_CreatePhoto.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
改为:
If ChannelID=1009 then
                Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreatePhoto_Content.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
Else
Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreatePhoto';document.myform.CreateType.value='3';document.myform.action='Admin_CreatePhoto.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
End If

<5>找到:

Response.Write "<input name='submit2' type='submit' id='submit2' onClick=""document.myform.Action.value='CreatePhoto';document.myform.action='Admin_CreatePhoto.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
改为:
If ChannelID=1009 then
            Response.Write "<input type='submit' onClick=""document.myform.action='Admin_CreatePhoto_Content.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
Else
Response.Write "<input name='submit2' type='submit' id='submit2' onClick=""document.myform.Action.value='CreatePhoto';document.myform.action='Admin_CreatePhoto.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
End If


2.生成内容页:Admin_CreatePhoto_Content.asp

<!--#include virtual="Conn/conn.asp"--> 

<!--#include virtual="Conn/inc.asp"--> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

body{margin:10px 0px 0px 0px;padding:0;font-size:12px;line-height:19px;}


a:link{text-decoration:none;color:#000000;}

a:visited{text-decoration:none;color:#000000;}

a:hover{text-decoration:none;color:#FF6600;}

a:active{text-decoration:none;color:#000000;}


ul{margin:0px; padding:0px;}

li{padding-left:15px;}

</style>

</head>


<body>

<%

ChannelID=request("ChannelID")

ClassID=request("ClassID")

PhotoID=request("PhotoID")


if ClassID<>0 then

IfClassID=" and ClassID in ("&GetClassChildID(ClassID)&")"

end if


if PhotoID<>"" then

IfPhotoID=" and PhotoID in ("&PhotoID&")"

end if


'查询频道信息

set ChannelRs=server.CreateObject("adodb.recordset")

ChannelSql="select ChannelShortName,ChannelItemUnit,ChannelDir from PE_Channel where ChannelID="&ChannelID

ChannelRs.open ChannelSql,conn,3,2


'查询要生成的文章

set PhotoIDRs=server.CreateObject("adodb.recordset")

PhotoIDSql="select PhotoID,PhotoName from PE_Photo where ChannelID="&ChannelID&IfClassID&IfPhotoID&" and Deleted=false order by PhotoID asc"

PhotoIDRs.open PhotoIDSql,conn,3,2

%>

<strong>正在生成内容页面……请稍候!<span style="color:#FF0000;">在此过程中请勿刷新此页面!!!</span></strong><br />

总共需要生成 <strong style="color:#FF0000;"><%=PhotoIDRs.recordcount%></strong> <%=ChannelRs("ChannelItemUnit")%><%=ChannelRs("ChannelShortName")%>

<UL>

<%

i=1

do while not PhotoIDRs.eof

PhotoID = PhotoIDRs("PhotoID")

FileName = PhotoID&".html"

FilePath = Server.MapPath("/"&ChannelRs("ChannelDir")&"/")&"\"&FileName

Do_Url = "http://"

Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&ChannelRs("ChannelDir")&"/ShowPhoto.asp"

Do_Url = Do_Url&"?PhotoID="&PhotoID



strUrl = Do_Url

dim objXmlHttp

set objXmlHttp = Server.createObject("Microsoft.XMLHTTP")



objXmlHttp.open "GET",strUrl,false

objXmlHttp.send()

Dim binFileData

binFileData = objXmlHttp.responseBody

Dim objAdoStream

set objAdoStream = Server.createObject("ADODB.Stream")

objAdoStream.Type = 1

objAdoStream.Open()

objAdoStream.Write(binFileData)

objAdoStream.SaveToFile FilePath,2

objAdoStream.Close()

%>


<li>成功生成 第 <strong style="color:#FF0000;"><%=i%></strong> <%=ChannelRs("ChannelItemUnit")%><%=ChannelRs("ChannelShortName")%>。&nbsp;&nbsp;&nbsp;ID:<%=PhotoID%>&nbsp;&nbsp;&nbsp;标题:<%=PhotoIDRs("PhotoName")%>&nbsp;&nbsp;&nbsp;地址:<a href="/<%=ChannelRs("ChannelDir")%>/<%=FileName%>" target="_blank">/<%=ChannelRs("ChannelDir")%>/<%=FileName%></a></li>


<%

i=i+1

PhotoIDRs.movenext

loop

PhotoIDRs.close

set PhotoIDRs=nothing

ChannelRs.close

set ChannelRs=nothing

%>

</UL>

<div style="line-height:30px;">

已经生成所有页面!<br />

<a href="Admin_Photo.asp?ChannelID=<%=ChannelID%>&Action=Manage&Status=3&ManageType=HTML">【返回】

</a></div>

</body>

</html>


注意:

1.频道设置-生成选项:

<1>生成HTML方式:全部生成 

<2>自动生成HTML时的生成方式:

不自动生成,由管理员手工生成相关页面

<3>栏目列表文件的存放位置:

列表文件统一保存在频道文件夹中

    例:Article/List_236.html(栏目首页)

        Article/List_236_2.html(第二页)

<4>目录结构方式:

频道/文件(直接放在频道目录中)

    例:Article/1368.html

<5>内容页文件的命名方式:

文章ID.html    例:1358.html

2.后台未二次开发,前台二次开发时,后台修改内容保存后动易系统会把该内容的html文件删除,解决办法:

注释Admin/Admin_Article.asp中的以下代码:

                '删除生成的文件,因为生成的文件可能会随着更新时间,游览权限等发生变化而产生多余的文件
                If UseCreateHTML > 0 And ObjInstalled_FSO = True Then
                    Dim tClass, ArticlePath
                    Set tClass = Conn.Execute("select ParentDir,ClassDir from PE_Class where ClassID=" & rsArticle("ClassID") & "")
                    If tClass.BOF And tClass.EOF Then
                        ParentDir = "/"
                        ClassDir = ""
                    Else
                        ParentDir = tClass("ParentDir")
                        ClassDir = tClass("ClassDir")
                    End If
                    ArticlePath = HtmlDir & GetItemPath(StructureType, ParentDir, ClassDir, rsArticle("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsArticle("UpdateTime"), rsArticle("ArticleID"))
                    If fso.FileExists(Server.MapPath(ArticlePath & FileExt_Item)) Then
                        DelSerialFiles Server.MapPath(ArticlePath & FileExt_Item)
                    End If
                    If rsArticle("PaginationType") > 0 Then
                        DelSerialFiles Server.MapPath(ArticlePath) & "_*.*"
                    End If
                End If
注释Admin/Admin_Photo.asp中的以下代码:
                '删除生成的文件,因为生成的文件可能会随着更新时间,游览权限等发生变化而产生多余的文件
                If UseCreateHTML > 0 And ObjInstalled_FSO = True Then
                    Dim tClass, PhotoPath
                    Set tClass = Conn.Execute("select ParentDir,ClassDir from PE_Class where ClassID=" & rsPhoto("ClassID") & "")
                    If tClass.BOF And tClass.EOF Then
                        ParentDir = "/"
                        ClassDir = ""
                    Else
                        ParentDir = tClass("ParentDir")
                        ClassDir = tClass("ClassDir")
                    End If
                    PhotoPath = HtmlDir & GetItemPath(StructureType, ParentDir, ClassDir, rsPhoto("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsPhoto("UpdateTime"), rsPhoto("PhotoID"))
                    If fso.FileExists(Server.MapPath(PhotoPath & FileExt_Item)) Then
                        DelSerialFiles Server.MapPath(PhotoPath & FileExt_Item)
                    End If
                End If


相关文章
导航分类
热门文章
关于我们| 联系我们| 免责声明| 网站地图|
CopyRight 2012-2015 www.diandiba.com - 点滴吧 All Rights Reserved
滇ICP备09005765号-2