| |

VerySource

 Forgot password?
 Register
Search
View: 7|Reply: 2

Method XMLHTTP generates static category pages, and the homepage is ok, let's talk about them, there are good methods f

[Copy link]

2

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-3-7 09:30:01
| Show all posts |Read mode
Apply the XMLHTTP method to import asp pages to generate statically:
program
'---------------
function getHTTPPage (url)
 dim Http
  set Http = server.createobject ("MSXML2.XMLHTTP")
  Http.open "GET", url, false
  Http.send ()
   if Http.readystate <> 4 then
    exit function
   end if
  getHTTPPage = bytesToBSTR (Http.responseBody, "GB2312")
  set http = nothing
   if err.number <> 0 then err.Clear
end function
'----------------
Function BytesToBstr (body, Cset)
 dim objstream
 set objstream = Server.CreateObject ("adodb.stream")
  objstream.Type = 1
  objstream.Mode = 3
  objstream.Open
  objstream.Write body
  objstream.Position = 0
  objstream.Type = 2
  objstream.Charset = Cset
  BytesToBstr = objstream.ReadText
  objstream.Close
 set objstream = nothing
End Function
'---------------------
Sub makehtml ()
Dim rsa
Dim Url, Html
dim filename, fso, fout
Set fso = Server.CreateObject ("Scripting.FileSystemObject")
Set rsa = server.CreateObject ("adodb.recordset")
rsa.open "select house_class_id from house_class", conn, 3,2
do while Not rsa.eof

  Url = "http: //"&request.ServerVariables ("Server_NAME")&"/house/house.asp?id="&rsa("house_class_id") "
  Html = getHTTPPage (Url)
  filename = "list"&rsa ("house_class_id")&-1&".htm"
  Set fout = fso.CreateTextFile (server.mappath (""&filename&""))
  fout.Write html
 rsa.movenext
loop
rsa.close
 fout.close
 set fout = nothing
 set fso = nothing
 if err then
 err.Clear
 response.Write ("An error occurred!")
 else
 response.write ("<br> <font color = '# ff0000'> Page <font> successfully generated")
 'response.write ("<meta http-equiv =' refresh 'content =' 2; URL = / house / index.htm '>")
 end if
End Sub
Call makehtml ()
Is this method good? If you can, then you can also generate the homepage,
Everyone talk about the good or bad of this method.This method is not fast.
I learned to apply one:
<script> function onDownloadDone (downDate) {showImport.innerHTML = downDate} oDownload.startDownload ('ASP file address', onDownloadDone) </ script> This generates each page individually, but how to implement it
Reply

Use magic Report

0

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-6-16 08:45:01
| Show all posts
Benefit: No template required
Disadvantages: slow speed
Reply

Use magic Report

2

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-6-17 16:45:02
| Show all posts
But apply this:
<script>function onDownloadDone(downDate){showImport.innerHTML=downDate}oDownload.startDownload('ASP file address',onDownloadDone)</script>
In this way, each page is generated individually, will the generation speed be much faster?
How to use this <script></script>, how to achieve it,
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list