分享

写回答

发帖

[提问] ASP生静态问题(GD空间),超奇怪!求助。。。

回答|共 27 个

adoresimon

发表于 2009-12-28 15:25:40 | 显示全部楼层

ASP商城程序, 应该是威博 修改而来的。

adoresimon

发表于 2009-12-28 18:39:34 | 显示全部楼层

还没解决,希望哪位达人相助

add.c

发表于 2009-12-28 21:01:59 | 显示全部楼层

你把生成静态的代码贴出来,或许有人可以帮你

adoresimon

发表于 2009-12-29 14:06:00 | 显示全部楼层

原帖由 add.c 于 2009-12-28 09:01 PM 发表
你把生成静态的代码贴出来,或许有人可以帮你


生静态主程序:
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp" -->
<%
dim siteUrl,htmlPostfix
'(网站的域名或网址)(后缀名)
'siteUrl="http://www.fashion-bop.com"
siteUrl="../../"
htmlPostfix=".html"

'清除服务器缓存
response.expires=0     
response.expiresabsolute=now()-1     
response.addHeader "pragma","no-cache"
response.addHeader "cache-control","private"  
Response.cachecontrol="no-cache"

if request.QueryString("action")<>1 then%>
<html>
<head><title>生成静态</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.STYLE1 {
        color: #FF0000;
        font-weight: bold;
}
-->
</style>
</head>
<body>
<form action="createhtml.asp?action=1" method="post" name="create">
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td colspan="1">
      <input id="checkall" name="checkbox" type="checkbox" onClick="mm()" value="Check All">
      <label for="checkall"><strong>全选</strong></label> </td>
      <td colspan="4"><span class="STYLE1">注意:尽量不要全选来生成静态,因为这样会对服务器造成重大负担。</span></td>
    </tr>
  <tr>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="index" value="index"/>
      <label for="index">Home</label></td>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="aboutus" value="aboutus"/>
<label for="aboutus">About Us</label></td>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="payment" value="payment"/>
<label for="payment">Payment</label></td>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="contactus" value="contactus">
<label for="contactus">Contact Us</label></td>
  </tr>
  <tr>
          <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="sitemap" value="sitemap"/>
<label for="sitemap">Sitemap</label></td>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="links" value="links" />
<label for="links">Links</label></td>
    <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="scout" value="scout"/>
<label for="scout">Scout</label></td>
          <td bgcolor="#fdfbdc"><input name="checkbox" type="checkbox" id="404" value="404"/>
<label for="404">404</label></td>
  </tr>
  <tr>
          <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="termsofuse" value="termsofuse"/>
<label for="termsofuse">Terms of Use</label></td>
        <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="help" value="help"/>
<label for="help">Help Center</label></td>
    <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="news" value="news"/>
<label for="news">News Center</label></td>
    <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="newsshow" value="newsshow"/>
<label for="newsshow">News Content</label></td>
  </tr>
  <tr>
    <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="question" value="question"/>
<label for="question">FAQ</label></td>
    <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="questionshow" value="questionshow"/>
<label for="questionshow">FAQ Content</label></td>
    <td bgcolor="#e0f2c2"><input name="checkbox" type="checkbox" id="feedback" value="feedback"/>
<label for="feedback">Feedback</label></td>
    <td bgcolor="#e0f2c2">&nbsp;</td>
  </tr>
  <tr>
          <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="productshow" value="productshow"/>
<label for="productshow">Products Page</label></td>
        <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="product" value="product"/>
<label for="product">Product Center</label></td>
    <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="productclass" value="productclass"/>
<label for="productclass">Product Category</label></td>
    <td bgcolor="#f5d1dd">&nbsp;</td>
  </tr>
  <tr>
          <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="product_new" value="product_new"/>
<label for="product_new">New In</label></td>
    <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="product_comment" value="product_comment"/>
<label for="product_comment">Special Offer</label></td>
        <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="product_hot" value="product_hot"/>
<label for="product_hot">Hot Sale</label></td>
    <td bgcolor="#f5d1dd"><input name="checkbox" type="checkbox" id="product_specail" value="product_specail"/>
<label for="product_specail">Special Offer</label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="30" colspan="5">
      <div align="center">
        <input type="submit" name="button" id="button" value="Start to Generate HTML" />
      </div></td>
    </tr>
</table>
</form>
</body>
</html>
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
          if (a.type == "checkbox") a.checked = true;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a.type == "checkbox") a.checked = false;
   }
}
</script>
<%else%>
<table>
  <tr>
    <td id="pp2"></td>
    <td id="pp2Text"></td>
  </tr>
</table>
<script type="text/javascript" src="../js/Progress.js"></script>
<script type="text/javascript">
function progress(stepval) {
var progress2 = new Progress("pp2", 0, 100, stepval, stepval, new ProgressStyle(300, 20, "#CC0000", "#FF3333"));
progress2.onPositionChange = function () {
    document.getElementById("pp2Text").innerHTML = parseInt(progress2.position * 100 / (progress2.max - progress2.min)) + "%";
};
progress2.create();
setInterval(function () { progress2.inc(); }, 3000);
}
</script>

<iframe id="iframe" width=0 height=0></iframe>
<div id="info"></div>
<%
dim add,url,http,reurl,i,fname,zname,strTemp
strTemp=""
response.Buffer=false
id = trim(request("id"))
strname = trim(request("checkbox"))
notalert=trim(request("notalert"))
strnames = split(strname,",")
for s=0 to UBound(strnames)
        htmlname=trim(strnames(s))
        aspname="hl_"&strnames(s)
       
        strURL=siteUrl&htmlname&".asp"
        strLink=siteUrl&htmlname&htmlpostfix
        select case htmlname
                case "index"
                        strCName="Home"
                        call creatHtml(strURL,strLink)
                case "aboutus"
                        strCName="About Us"
                        call creatHtml(strURL,strLink)
                case "payment"
                        strCName="Payment"
                        call creatHtml(strURL,strLink)
                case "contactus"
                        strCName="Contact Us"
                        call creatHtml(strURL,strLink)
                case "feedback"
                        strCName="Feedback"
                        call creatHtml(strURL,strLink)
                case "sitemap"
                        strName="Sitemap"
                        call creatHtml(strURL,strLink)
                case "links"
                        strCName="Links"
                        call creatHtml(strURL,strLink)
                        MyArray = Array("About Us","Payment","Contact Us","Feedback")
                        MyArray2 = Array("aboutus","payment","contactus","feedback")
                        for i=0 to ubound(MyArray)
                                strCName=MyArray(i)
                                strURLTemp=siteUrl&MyArray2(i)&".asp"
                                strLinkTemp=siteUrl&MyArray2(i)&htmlpostfix
                                call creatHtml(strURLTemp,strLinkTemp)
                        next
                case "404"
                        strCName="404"
                        call creatHtml(strURL,strLink)
                case "scout"
                        strCName="Scout"
                        call creatHtml(strURL,strLink)
                case "help"
                        strCName="Help Center"
                        sqlTemp="select * from news where newsclassID=3"
                        call creatHtml3(sqlTemp,"help")
                        call creatHtml("","")
                case "termsofuse"
                        strCName="Terms of Use"
                        sqlTemp="select * from news where newsclassID=10"
                        call creatHtml3(sqlTemp,"termsofuse")
                        call creatHtml("","")
                case "news"
                        strCName="News Center"
                        sqlTemp="select * from news where newsclassID=2"
                        call creatHtml2(sqlTemp,0,20,1,"news")
                case "newsshow"
                        strCName="News Content"
                        sqlTemp="select * from news where newsclassID=2"
                        call creatHtml3(sqlTemp,"newsshow")
                case "question"
                        strCName="FAQ"
                        sqlTemp="select * from news where newsclassID=4"
                        call creatHtml2(sqlTemp,0,20,1,"question")
                case "questionshow"
                        strCName="FAQ Content"
                        strSQLTemp="select * from news where newsclassID=4"
                        call creatHtml3(strSQLTemp,"questionshow")
                case "productshow"        '产品内容页
                        strCName="Products Page"
                        strSQLTemp="select * from product where flag=1"
                        call creatHtml3(strSQLTemp,"productshow")
                case "productclass"
                        strCName="Product Category"
                        iBigclass=11        '大类ID
                        for a=1 to iBigclass
                                strDefaultSQL="SELECT product.ID, product.Name, product.price, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                                strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1)"
                                strKH=")"
                                strOrder=" ORDER BY product.addDate DESC"
                                if a<>"7" then
                                        strDefaultWhere=strDefaultWhere&" AND ((productclass.scoreflag)<>1)"
                                end if
                               
                                if a="0" then
                                        strElseWhere=""
                                else
                                        if a="8" then        '下架商品区
                                                strElseWhere=" And ((product.classflag)=0)"
                                        else
                                                strElseWhere=" And ((product.classflag)<>0) AND ((product.productclassID)="&a&")"
                                        end if
                                end if
                                sqlProduct=strDefaultSQL&strDefaultWhere&strElseWhere&strKH&strOrder
                                call creatHtml2(sqlProduct,a,36,1,"productclass")
                        next
                case "product"        '产品中心
                        strCName="Product Center"
                        'iCount=11        '每页显示数
                        'iBigclass=0        '大类ID
                        'iPS=4        '排序个数
                        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0)"
                        strKH=")"
                        sqlProduct=strDefaultSQL&strDefaultWhere&strKH
                        call creatHtml2(sqlProduct,0,11,4,"product")
                case "product_new"        '最新上架
                        strCName="New In"
                        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0) AND ((product.classflag)=1)"
                        strKH=")"
                        sqlProduct=strDefaultSQL&strDefaultWhere&strKH
                        call creatHtml2(sqlProduct,1,36,4,"product")
                case "product_comment"        '推荐商品
                        strCName="Special Offer"
                        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0) AND ((product.classflag)=2)"
                        strKH=")"
                        sqlProduct=strDefaultSQL&strDefaultWhere&strKH
                        call creatHtml2(sqlProduct,2,36,4,"product")
                case "product_hot"        '热销商品
                        strCName="Hot Sale"
                        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0) AND ((product.classflag)=3)"
                        strKH=")"
                        sqlProduct=strDefaultSQL&strDefaultWhere&strKH
                        call creatHtml2(sqlProduct,3,36,4,"product")
                case "product_specail"        '特价商品
                        strCName="Special Offer"
                        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
                        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0) AND ((product.hotflag)=1)"
                        strKH=")"
                        sqlProduct=strDefaultSQL&strDefaultWhere&strKH
                        call creatHtml2(sqlProduct,4,36,4,"product")
        end select
next
strTemp=left(strTemp,instrrev(strTemp,",")-1)
call creathtmlbyjs(strTemp)
end if

'有iframe加载要生成静态的页面
sub creatHtml(strURL,strLink)
        if strLink="" then strLink=siteUrl&htmlname&htmlPostfix
        if strURL="" then strURL=siteUrl&htmlname&".asp"
        url=JoinChar(strURL)&"postfix="&htmlPostfix&"&writeflag=1&"&Int((9999) * Rnd(Now())+1)
        strURL=""
        strTemp=strTemp&chr(34)&strCName&"|||"&strLink&"|||"&siteUrl&strLink&"|||"&url&chr(34)&","
end sub

'生成静态,用于大类,排序,分页
sub creatHtml2(strSQL,iBigclass,iCount,iPS,fName)
recodeCount=PageTotal(strSQL)
if recodeCount mod iCount=0 then
        iPage= recodeCount \ iCount
else
        iPage= recodeCount \ iCount+1
end if
if iPage=0 then iPage=1
for i=1 to iPage
        for j=1 to iPS
                strURL=siteUrl&fName&".asp?bigclass="&iBigclass&"&ps="&j&"&page="&i
                strLink=siteUrl&fName&"_"&iBigclass&"_"&j&"_"&i&htmlpostfix
                url=JoinChar(strURL)&"postfix="&htmlPostfix&"&writeflag=1&"&Int((9999) * Rnd(Now())+1)
                strTemp=strTemp&chr(34)&strCName&"|||"&strLink&"|||"&siteUrl&strLink&"|||"&url&chr(34)&","
        next
next
end sub

'生成静态,用于用ID号的
sub creatHtml3(strSQL,fName)
Set rsHTML= Server.CreateObject("ADODB.Recordset")
rsHTML.open strSQL,conn,1,1
if not rsHTML.eof then
        do until rsHTML.eof
                strURL=siteUrl&fName&".asp?id="&rsHTML("ID")
                strLink=siteUrl&fName&"_"&rsHTML("ID")&htmlpostfix
                url=JoinChar(strURL)&"postfix="&htmlPostfix&"&writeflag=1&"&Int((9999) * Rnd(Now())+1)
                strTemp=strTemp&chr(34)&strCName&"|||"&strLink&"|||"&siteUrl&strLink&"|||"&url&chr(34)&","
                rsHTML.movenext
        loop
end if
rsHTML.close
set rsHTML=nothing
end sub

'JS隔时生成静态页面
sub creathtmlbyjs(pageList)
Response.Write "<script type=""text/javascript"">"&vbcrlf
Response.Write "        var iframe = document.getElementById(""iframe"");"&vbcrlf
Response.Write "        var info = document.getElementById(""info"");"&vbcrlf
Response.Write "        var urls = ["&vbcrlf
Response.Write pageList&vbcrlf
Response.Write "        ];"&vbcrlf
Response.Write "        var stepval = 100/(Number(urls.length)-1);"&vbcrlf
Response.Write "        progress(stepval);"&vbcrlf
Response.Write "        var time = 3000, index = 0;        //定义每生成一个页面隔格的时间"&vbcrlf
Response.Write "        change();"&vbcrlf
Response.Write "        function change(){"&vbcrlf
Response.Write "                var ulrsTemp=urls[index].split(""|||"");"&vbcrlf
Response.Write "                var pageCName = ulrsTemp[0];"&vbcrlf
Response.Write "                var pageName = ulrsTemp[1];"&vbcrlf
Response.Write "                var pageLink = ulrsTemp[2];"&vbcrlf
Response.Write "                var url = ulrsTemp[3];"&vbcrlf
Response.Write "                iframe.setAttribute(""src"", url);"&vbcrlf
Response.Write "                info.innerHTML+=""Generated [""+pageCName+""--""+pageName+""],<a href='""+pageLink+""' target='_blank'>Click to view</a><br/>"";"&vbcrlf
Response.Write "                if(index == urls.length - 1){"&vbcrlf
Response.Write "                        stoper();"&vbcrlf
Response.Write "                }else{"&vbcrlf
Response.Write "                        index ++;"&vbcrlf
Response.Write "                }"&vbcrlf
Response.Write "                var creathtml=setTimeout(change, time);"&vbcrlf
Response.Write "        }"&vbcrlf
Response.Write "        function stoper() {"&vbcrlf
Response.Write "                alert(""Html pages all generated!"");"&vbcrlf
Response.Write "                clearTimeout(creathtml);"&vbcrlf
Response.Write "        }"&vbcrlf
Response.Write "</script>"&vbcrlf
end sub
       
'函数名:getPageTotal
'作  用:得到页面总数
'参  数:strSQL----要查询的数据表SQL语句
'=================================================
function PageTotal(strSQL)
        Set rsTotal= Server.CreateObject("ADODB.Recordset")
        rsTotal.open strSQL,conn,1,1
        if rsTotal.eof and rsTotal.bof then
                PageTotal=0
        else
                PageTotal=rsTotal.recordcount
        end if
        rsTotal.close
        set rsTotal=nothing
end function
%>

adoresimon

发表于 2009-12-29 14:06:45 | 显示全部楼层

生静态功能程序:
<%
server.ScriptTimeout=9999
'=================================================
'过程名:createhtml
'作  用:生成HTML文件
'参  数:无
'=================================================
sub createhtml(url,add)
  set http=Server.createobject("Microsoft.XMLHTTP")
  rUrl=JoinChar(url)
  rUrl = rUrl & "rNum=" & Int((9999) * Rnd(Now())+1)
  Http.open "GET",rUrl,false
  Http.send()
  deleteFiles(add)
  set objStream = Server.CreateObject("ADODB.Stream")
  objStream.type = 1
  objStream.open
  objstream.write http.responseBody
  objstream.saveToFile server.mappath(add),2
end sub

Function deleteFiles(filespec)
''//功能:文件删除
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If isfile(filespec) = true Then
on error resume next
fso.deleteFile(server.MapPath(filespec))
End if
end function

'文件是否存在
function isfile(files)
set objfso=server.createobject("scripting.filesystemobject")
if objfso.fileexists(server.mappath(files)) then
isfile=True
else
isfile=False
end if  
set objfso=nothing  
end function

'=================================================
'过程名:createhtmlpage
'作  用:生成有条件的HTML文件,如:分页,大类、其它参数
'参  数:isiclass----是否自定大类,是为1;否为0
'        classname----大类的表的名称
'        classidname----大类的字段名称
'        bigclass----大类值(手动赋值)
'        ps----排序
'        page----页数
'        hlname----转成HTML的文件名
'        aspname----默认要转换的文件名,即不带参数的文件名
'说  明: 生成的文件名是[defaultname_bigclass_ps_page],例:product_0_1_1.html,参数值=0,即无。
'=================================================
sub createhtmlpage(isiclass,classname,classidname,bigclass,ps,page,hlname,aspname,zname)
if isiclass=0 and ps=0 and page=0 then
    fname=hlname & htmlPostfix
    url=siteUrl&"/"&aspname&".asp"
    add="../../"&fname
    call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
elseif isiclass=1 and ps=0 and page=0 then
    if bigclass=0 and classname<>"" then
        Set rs= Server.CreateObject("ADODB.Recordset")
    strSQL="select * from " & classname
    rs.open strSQL,conn,1,1
    do until rs.eof
    fname=hlname & "_" & rs(classidname) &"_0_0"&htmlPostfix
        url=siteUrl&"/"&aspname&".asp?"&classidname&"="&rs(classidname)
    add="../../"&fname
    call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
    rs.movenext
    loop
    rs.close
    set rs=nothing
        elseif bigclass<>0 and classname="" then
        fname=hlname & "_" & bigclass &"_0_0"&htmlPostfix
    url=siteUrl&"/"&aspname&".asp?bigclass="&bigclass
    add="../../"&fname
    call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
        else
        Response.Write "<script>alert('["&zname&"]参数设置有误,请修改!')</script>"
        response.end
        end if
elseif isiclass=0 and ps<>0 and page=0 then
    for i=1 to ps
        fname=hlname & "_0_" & i & "_0"&htmlPostfix
    url=siteUrl&"/"&aspname&".asp?ps="&i
    add="../../"&fname
    call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
    next
elseif isiclass=0 and ps=0 and page<>0 then
    for i=1 to page
        fname=hlname & "_0_0_" & i & htmlPostfix
    url=siteUrl&"/"&aspname&".asp?page="&i
    add="../../"&fname
    call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
    next
elseif isiclass=1 and ps<>0 and page=0 then
    if bigclass=0 and classname<>"" then
        Set rs= Server.CreateObject("ADODB.Recordset")
    strSQL="select * from " & classname
    rs.open strSQL,conn,1,1
    do until rs.eof
        for i=1 to ps
            fname=hlname & "_"& rs(classidname) & "_" & i & "_0"&htmlPostfix
        url=siteUrl&"/"&aspname&".asp?"&classidname&"="&rs(classidname)&"&ps="&i
        add="../../"&fname
        call createhtml(url,add)
                response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                next
    rs.movenext
    loop
    rs.close
    set rs=nothing
        elseif bigclass<>0 and classname="" then
        for i=1 to ps
            fname=hlname & "_"& bigclass & "_" & i & "_0"&htmlPostfix
        url=siteUrl&"/"&aspname&".asp?bigclass="&bigclass&"&ps="&i
        add="../../"&fname
        call createhtml(url,add)
                response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                next
        else
        Response.Write "<script>alert('["&zname&"]参数设置有误,请修改!')</script>"
        response.end
        end if
elseif isiclass=1 and ps=0 and page<>0 then
    if bigclass=0 and classname<>"" then
        Set rs= Server.CreateObject("ADODB.Recordset")
    strSQL="select * from " & classname
    rs.open strSQL,conn,1,1
    do until rs.eof
        for i=1 to page
            fname=hlname & "_"& rs(classidname) & "_0_" & i & htmlPostfix
        url=siteUrl&"/"&aspname&".asp?"&classidname&"="&rs(classidname)&"&page="&i
        add="../../"&fname
        call createhtml(url,add)
                response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                next
                rs.movenext
    loop
    rs.close
    set rs=nothing
        elseif bigclass<>0 and classname="" then
        for i=1 to page
            fname=hlname & "_"& bigclass & "_0_" & i & htmlPostfix
        url=siteUrl&"/"&aspname&".asp?bigclass="&bigclass&"&page="&i
        add="../../"&fname
        call createhtml(url,add)
                response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                next
        else
        Response.Write "<script>alert('["&zname&"]参数设置有误,请修改!')</script>"
        response.end
        end if
elseif isiclass=0 and ps<>0 and page<>0 then
    for a=1 to ps
        for i=1 to page
            fname=hlname & "_0_"& a & "_" & i & htmlPostfix
        url=siteUrl&"/"&aspname&".asp?ps="&a&"&page="&i
        add="../../"&fname
        call createhtml(url,add)
                response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                next
    next
elseif isiclass=1 and ps<>0 and page<>0 then
    if bigclass=0 and classname<>"" then
        Set rs= Server.CreateObject("ADODB.Recordset")
    strSQL="select * from " & classname
    rs.open strSQL,conn,1,1
    do until rs.eof
        for a=1 to ps
            for i=1 to page
                fname=hlname & "_" & rs(classidname) & "_"& a & "_" & i & htmlPostfix
            url=siteUrl&"/"&aspname&".asp?"&classidname&"="&rs(classidname)&"&ps="&a&"&page="&i
            add="../../"&fname
            call createhtml(url,add)
                        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                    next
                next
                rs.movenext
    loop
    rs.close
    set rs=nothing
        elseif bigclass<>0 and classname="" then
        for a=1 to ps
            for i=1 to page
                fname=hlname & "_" & bigclass & "_"& a & "_" & i & htmlPostfix
            url=siteUrl&"/"&aspname&".asp?bigclass="&bigclass&"&ps="&a&"&page="&i
            add="../../"&fname
            call createhtml(url,add)
                        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
                    next
                next
        else
        Response.Write "<script>alert('["&zname&"]参数设置有误,请修改!')</script>"
        response.end
        end if
end if
end sub

'=================================================
'过程名:createhtmlid
'作  用:生成有条件的HTML文件,针对带ID参数的。
'参  数:bigclass----大类
'        ps----排序
'        page----页数
'        hlname----转成HTML的文件名
'        aspname----默认要转换的文件名,即不带参数的文件名
'说  明: 生成的文件名是[defaultname_bigclass_ps_page],例:product_0_1_1.html,参数值=0,即无。
'=================================================

sub createhtmlid(strSQL,idname,hlname,aspname,zname)
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open strSQL,conn,1,1
do until rs.eof
    fname=hlname & "_" & rs(idname) & htmlPostfix
        url=siteUrl&"/"&aspname&".asp?" & idname & "="&rs(idname)
        add="../../"&fname
        call createhtml(url,add)
        response.write "Generated ["&zname&"--"&fname&"], <a href='"&siteUrl&"/"&fname&"' target='_blank'>Click to view</a><br>"
        rs.movenext
loop
rs.close
set rs=nothing
end sub

'=================================================
'过程名:createhtml_newsClass
'作  用:生成文章类的HTML文件,包括新闻公告,帮助中心,常见问题等。。
'参  数:strID----类别ID号
'        zname----中文名称
'        hlname----转成HTML的文件名
'        aspname----默认要转换的文件名,即不带参数的文件名
'=================================================
sub createhtml_newsClass(strID,strpage,hlname,aspname,zname)
        call createhtmlpage(0,"","",0,0,0,hlname,aspname,zname)
        strSQLTemp="select * from news where newsclassID="&strID
        pagetotal=intPage(intTotal(strSQLTemp),strpage)
        call createhtmlpage(0,"","",0,0,pagetotal,hlname,aspname,zname)
end sub

'=================================================
'过程名:createhtml_product
'作  用:生成产品列表的HTML文件(非产品显示页)
'参  数:classflag--分类数字,0为不分,1为最新上架,2为推荐商品,3为特价商品
'=================================================
sub createhtml_product(classflag)
        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.classflag, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.scoreflag)<>1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1) And ((product.classflag)<>0))"
        strSQLTemp=strDefaultSQL&strDefaultWhere
        pagetotal=intPage(intTotal(strSQLTemp),11)
        if classflag=0 then
                call createhtmlpage(0,"","",0,0,0,"product","hl_product","Product Center")
                call createhtmlpage(0,"","",0,0,pagetotal,"product","hl_product","Product Center")
                call createhtmlpage(0,"","",0,5,pagetotal,"product","hl_product","Product Center")
        else
                select case classflag
                case 1
                        call createhtmlpage(1,"","",1,5,pagetotal,"product","hl_product","New In")
                case 2
                        call createhtmlpage(1,"","",2,5,pagetotal,"product","hl_product","Special Offer")
                case 3
                        call createhtmlpage(1,"","",3,5,pagetotal,"product","hl_product","Special Offer")
                end select
        end if
end sub

'=================================================
'过程名:createhtml_productclass
'作  用:生成产品类别列表的HTML文件
'参  数:无
'=================================================
sub createhtml_productclass()
        call createhtmlpage(0,"","",0,0,0,"productclass","hl_productclass","Product Category")
        strDefaultSQL="SELECT product.ID, product.Name, product.price, product.newflag, product.hotflag, product.stock, productclass.Name, product.commendflag, product.flag, product.addDate, product_photo.path, product.Code, product.viewCount, productclass.scoreflag, product.productclassID FROM ((product INNER JOIN product_photo ON product.ID = product_photo.productID) INNER JOIN photo ON product_photo.photoID = photo.ID) INNER JOIN productclass ON product.productclassID = productclass.ID"
        strDefaultWhere=" WHERE (((product.flag)=1) AND ((productclass.flag)<>1) AND ((photo.flag)<>1) AND ((photo.indexflag)=1))"
        strOrder=" ORDER BY product.addDate DESC"
        strSQLTemp=strDefaultSQL&strDefaultWhere&strOrder
        pagetotal=intPage(intTotal(strSQLTemp),40)
        call createhtmlpage(0,"","",0,0,pagetotal,"productclass","hl_productclass","Product Category")
        Set rsclass= Server.CreateObject("ADODB.Recordset")
        strSQL="select * from productclass where flag=0"
        rsclass.open strSQL,conn,1,1
        do until rsclass.eof
                strSQLTemp="select * from product where productclassID="&rsclass("ID")&" and flag=1"
                pagetotal=intPage(intTotal(strSQLTemp),40)
                call createhtmlpage(1,"productclass where flag=0","ID",0,0,pagetotal,"productclass","hl_productclass","Product Category")
                rsclass.movenext
        loop
        rsclass.close
        set rsclass=nothing
end sub
'=================================================
'函数名:intTotal
'作  用:显示产品总数
'参  数:strSQL----要查询的数据表SQL语句
'=================================================
function intTotal(strSQL)
        dim sqlTotal
        dim rsTotal
        sqlTotal=strSQL
        Set rsTotal= Server.CreateObject("ADODB.Recordset")
        rsTotal.open sqlTotal,conn,1,1
        if rsTotal.eof and rsTotal.bof then
                intTotal=0
        else
                intTotal=rsTotal.recordcount
        end if
        rsTotal.close
        set rsTotal=nothing
end function

'=================================================
'函数名:intPage
'作  用:显示产品页数
'参  数:intTotal----产品总数
'        maxperpage----每页显示产品数
'=================================================
function intPage(intTotal,maxperpage)
    if intTotal mod maxperpage=0 then
            intPage= intTotal \ maxperpage
          else
            intPage= intTotal \ maxperpage+1
          end if
end function
%>

adoresimon

发表于 2009-12-29 14:11:46 | 显示全部楼层

在本地运行很好,没问题,可是上传到GD空间,payment.asp 和productshow.asp就这两个没法生成,确切的说是生成了空白的html文件。。。请达人相助! 可适当有偿报酬。

add.c

发表于 2009-12-29 14:15:16 | 显示全部楼层

set objfso=server.createobject("scripting.filesystemobject")
这行代码里使用的createobject是不支持的

adoresimon

发表于 2009-12-29 14:38:12 | 显示全部楼层

原帖由 add.c 于 2009-12-29 02:15 PM 发表
set objfso=server.createobject("scripting.filesystemobject")
这行代码里使用的createobject是不支持的


版主有什么解决方案没呢?或者需要替换掉那些命令,我很愿意试试。 prductshow.asp那个展示页的文件,你需要看不呢? 先提前谢谢你如果能解决我的问题的话。
productshow见附件
fashion-bop.rar (5.23 KB, 下载次数: 88)

adoresimon

发表于 2009-12-30 20:55:03 | 显示全部楼层

谁能帮帮我呀。。。大虾们?

广木

发表于 2009-12-30 21:35:43 | 显示全部楼层

不要急..慢慢找一找应该是路径不对...

评分

参与人数 1金币 +2 收起 理由
add.c + 2 助人为乐

查看全部评分

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

本版积分规则