讨论新浪(或者csdn)生成shtml是如何实现的!!

loveyourvv 2004-12-04 05:58:40
讨论新浪(或者csdn)生成shtml是如何实现的!!
这种方式对服务器来说特别是数据库服务器来说小了很多。但是具体如何实现,想跟大家讨论一下!!多谢!!
...全文
318 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
tigerhu76 2005-01-24
  • 打赏
  • 举报
回复
mark
冰泽水 2005-01-24
  • 打赏
  • 举报
回复
个人认为就是一个新闻发布信息,
aner 2005-01-24
  • 打赏
  • 举报
回复
请教:"lawyu(雨淋漓)"
是不是一但生成那么"相关链接"的内容就不能改了?
pizi611 2005-01-24
  • 打赏
  • 举报
回复
我也想知道在apache的配置文件上面有需要什么改动
lawyu 2005-01-24
  • 打赏
  • 举报
回复
应该就是模板生成的
:)
aner 2005-01-24
  • 打赏
  • 举报
回复
新浪、搜狐里的shtml的“相关链接”的内容是怎样生成的???
Onlyfu 2004-12-06
  • 打赏
  • 举报
回复
我也比较想知道这个东西,有没有人能提供一点资料或者例子什么的。先谢了!!
loveyourvv 2004-12-05
  • 打赏
  • 举报
回复
谢谢各位的讨论!!!
arcow 2004-12-04
  • 打赏
  • 举报
回复
生成shtml和html有差别嘛?
qunluo 2004-12-04
  • 打赏
  • 举报
回复
网上太多这样的例子!!!

在说了,什么html还是shtml还是htm没什么差别嘛!
都是一样的原理!!FSO数据处理!
xiaoyuehen 2004-12-04
  • 打赏
  • 举报
回复
如果你对这方面有兴趣, 我推荐你去这个论坛看看
http://bbs.tsyschina.com/default.asp

该网站有个开源的项目tsys, 专门讨论静态页面生成管理..软件本身构架得也很不错(个人觉得), 具有比较良好的代码风格.
xiaoyuehen 2004-12-04
  • 打赏
  • 举报
回复
摘一部份我收集修改的代码给大家, 需要的兄弟自己看着更改吧, 其他无关的函数我就不贴了.

Rem #################################################################
Rem ## 路径检测
Function CheckFolder(strPath)
Dim Fso
Set Fso = CreateObject("Scripting.FileSystemObject")

CheckFolder = fso.FolderExists(strPath)
End Function
Rem #################################################################

Rem #################################################################
Rem ## 路径检测
Function CheckFile(strPath)
Dim Fso
Set Fso = CreateObject("Scripting.FileSystemObject")

CheckFile = fso.FileExists(strPath)
End Function
Rem #################################################################

Rem #################################################################
Rem ## 文件名有效性检测
Private Function CheckFileName(strFileName)
CheckFileName = False

If strFileName = "" Or IsNull(strFileName) Then Exit Function
If Instr(1, strFileName, "\", 1) Then Exit Function
If Instr(1, strFileName, "/", 1) Then Exit Function
If Instr(1, strFileName, ":", 1) Then Exit Function
If Instr(1, strFileName, "*", 1) Then Exit Function
If Instr(1, strFileName, "?", 1) Then Exit Function
If Instr(1, strFileName, """", 1) Then Exit Function
If Instr(1, strFileName, "<", 1) Then Exit Function
If Instr(1, strFileName, ">", 1) Then Exit Function
If Instr(1, strFileName, "|", 1) Then Exit Function

CheckFileName = True
End Function
Rem #################################################################

Rem #################################################################
Rem ## 远程获得内容
Private Function GetContent(strUrl)
GetContent = ""

Dim oXhttp, strContent
Set oXhttp = Server.CreateObject("Microsoft.XMLHTTP")
On Error Resume Next
With oXhttp
.Open "GET", strUrl, False, "", ""
.Send
strContent = .Responsebody

strContent = BytesToBstr(strContent)
End With

Set oXhttp = Nothing
If Err.Number <> 0 Then
oSys.addmessage Err.Description
Err.Clear
Exit Function
End If

GetContent = strContent
End Function
Rem #################################################################

Rem #################################################################
Rem ## 编码转换 2进制 => 字符串
Private Function BytesToBstr(vIn)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write vIn
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Rem #################################################################

Rem #################################################################
Rem ## 编码转换 2进制 => 字符串
Private Function sDoCreateFile(strPath, strFileName, ByRef strContent)
sDoCreateFile = False

Rem ## 检测路径及文件名有效性
If Not(CheckFolder(strPath)) Then Exit Function
If Not(CheckFileName(strFileName)) Then Exit Function

If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
Dim strFullFileName
strFullFileName = strPath & strFileName

Rem ## 生成文件
Dim objStream

On Error Resume Next
Set objStream = Server.CreateObject("ADODB.Stream")
If Err.Number=-2147221005 Then
oSys.addmessage "主机不支持ADODB.Stream"
Err.Clear
Exit Function
End If

On Error Resume Next
With objStream
.Type = 2
.Open
.Charset = "GB2312"
.Position = objStream.Size
.WriteText = strContent
.SaveToFile strFullFileName, 2
.Close
End With
If Err.Number <> 0 Then
oSys.addmessage strFullFileName
oSys.addmessage Err.Description
Err.Clear
Exit Function
Else
oSys.addmessage strFullFileName
End If
Set objStream = Nothing

sDoCreateFile = True
End Function
Rem #################################################################

Rem #################################################################
Rem ## 逝去时间
Private Function processTime(intFlag)
Dim IntProcessSecond, Result, dtaEnd
dtaEnd = Timer()
IntProcessSecond = FormatNumber((dtaEnd - dtaStart) * 1000, 3, True)

Select Case intFlag
Case 0
Result = "花费时间: " & IntProcessSecond & "毫秒"
Case 1
Case 2
Case 3
End Select

processTime = Result
End Function
Rem #################################################################
hflsj 2004-12-04
  • 打赏
  • 举报
回复
新闻系统 用模板生成静态文件
zhgroup 2004-12-04
  • 打赏
  • 举报
回复
个人觉得是用模板来实现的,或者在shtml中用<script src=xxx.asp></script>来实现,
其中xxx.asp是动态的部分,xxx.asp输入页面脚本
zola2399 2004-12-04
  • 打赏
  • 举报
回复
我关注
loveyourvv 2004-12-04
  • 打赏
  • 举报
回复
找了风讯在线但是没有找到有价值的东西!!alexzhang00(三角猫) 有没有好的建议??
DeltaCat 2004-12-04
  • 打赏
  • 举报
回复
又讨论?
hongyanyufei 2004-12-04
  • 打赏
  • 举报
回复
建议找风讯在线的网站程序来看看,听说风讯一直都是模仿新浪的

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧