Bug描述:生成地图链接有误,且关闭模版调试模式时,无法生成网站地图。
此bug修复方法如下:
打开文件 admin/SiteMap.asp
分别将99行、214行、238行、259行代码
1 |
cURL=Server.HTMLEncode(Replace(Fk_Site_Url&cURL, "//" , "/" )) |
替换为以下代码
1 |
cURL=Server.HTMLEncode(Replace(Replace(Fk_Site_Url&CURL, "//" , "/" ), "http:/" , "http://" )) |
保存文件,这4处替换是解决生成的链接有误(http:/替换为http://)。
接着,我们来解决关闭模版调试模式时,无法生成网站地图的问题。
将第64行代码
1 |
Dim c_Rs,cURL |
替换为
1 |
Dim mRs,c_Rs,cURL |
将第67行代码
1 |
Set c_Rs=Server.Createobject( "Adodb.RecordSet" ) |
替换为以下代码
1 2 |
Set mRs=Server.Createobject( "Adodb.RecordSet" ) Set c_Rs=Server.Createobject( "Adodb.RecordSet" ) |
将第91行-230行代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
'生成栏目页 Sqlstr= "Select Fk_Module_Id,Fk_Module_Type,Fk_Module_Model,Fk_Module_FixedUrl,Fk_Module_Url,Fk_Module_LinkType,Fk_Module_PageSize,Fk_Module_Menu,Fk_Module_GBookReply,Fk_Module_Template From [Fk_Module] Where Fk_Module_State=1 Order By Fk_Module_Id Asc" Rs.Open Sqlstr,Conn,1,1 If Not Rs.Eof Then While Not Rs.Eof If (Rs( "Fk_Module_LinkType" )=1 And Rs( "Fk_Module_Type" )=4) Or Instr( ",0,2," , "," &Rs( "Fk_Module_Type" )& "," )>0 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" ,Rs( "Fk_Module_Url" )& "Index" , "" ,PageSuffix,1,Rs( "Fk_Module_Id" ),Rs( "Fk_Module_FixedUrl" )) '生成 cURL=Replace(cURL, "Index" &PageSuffix, "" ) cURL=Server.HTMLEncode(Replace(Fk_Site_Url&cURL, "//" , "/" )) CreateHtml=CreateHtml& "<url>" &vbLf CreateHtml=CreateHtml& "<loc>" &cURL& "</loc>" &vbLf If CreateType=1 Then CreateHtml=CreateHtml& "<lastmod>" & Date ()& "</lastmod>" &vbLf CreateHtml=CreateHtml& "<changefreq>daily</changefreq>" &vbLf CreateHtml=CreateHtml& "<priority>0.7</priority>" &vbLf End If CreateHtml=CreateHtml& "</url>" &vbLf ElseIf Instr( ",1,3," , "," &Rs( "Fk_Module_Type" )& "," )>0 Then '读取每页数量 PageSizes=Fk_Site_PageSize If Rs( "Fk_Module_PageSize" )>0 Then PageSizes=Rs( "Fk_Module_PageSize" ) End If '读取模型绑定模板 If Rs( "Fk_Module_Type" )=1 Then Sqlstr= "Select Fk_Model_Template From [Fk_Model] Where Fk_Model_Id=" &Rs( "Fk_Module_Model" )& "" c_Rs.Open Sqlstr,Conn,1,1 If Not c_Rs.Eof Then mModelTemplate=c_Rs( "Fk_Model_Template" ) Else mModelTemplate= "" End If c_Rs.Close Else mModelTemplate= "" End If If Rs( "Fk_Module_Type" )=1 Then PageTemplate= "viewlist" ElseIf Rs( "Fk_Module_Type" )=3 Then PageTemplate= "gbook" End If If Rs( "Fk_Module_Template" )<> "" Then PageTemplate=Rs( "Fk_Module_Template" ) ElseIf mModelTemplate<> "" Then PageTemplate=mModelTemplate End If '菜单信息读取 Sqlstr= "Select Fk_Menu_Dir,Fk_Menu_Template From [Fk_Menu] Where Fk_Menu_Id=" & Rs( "Fk_Module_Menu" ) c_Rs.Open Sqlstr,Conn,1,1 If Not c_Rs.Eof Then MenuDir=c_Rs( "Fk_Menu_Dir" ) MenuTemplate=c_Rs( "Fk_Menu_Template" ) Else c_Rs.Close Call FKFun.ShowErr( "error:菜单不存在!" ,0) End If c_Rs.Close '目录模板方案_默认模板组合 If MenuTemplate<> "" Then If Instr(DisTemplate, "," &PageTemplate& "," )>0 Then PageTemplate=MenuTemplate& "/" &PageTemplate End If End If '模板标签解析 PageCode=FKTemplate.GetTemplate(PageTemplate) PageCounts=1 '读取页数 If Instr(PageCode, "{$ModulePageCode(" )>0 Then '内容模块 If Rs( "Fk_Module_Type" )=1 Then Sqlstr= "Select Fk_View_Id From [Fk_View] Where Fk_View_Show=1 And Fk_View_Module=" &Rs( "Fk_Module_Id" )& "" c_Rs.Open Sqlstr,Conn,1,1 c_Rs.PageSize=PageSizes If c_Rs.PageCount>0 Then PageCounts=c_Rs.PageCount End If c_Rs.Close '留言模块 ElseIf Rs( "Fk_Module_Type" )=3 And Rs( "Fk_Module_GBookReply" )<>3 Then Sqlstr= "Select Fk_GBook_Id From [Fk_GBook] Where Fk_GBook_Module=" &Rs( "Fk_Module_Id" )& "" If Rs( "Fk_Module_GBookReply" )=1 Then Sqlstr=Sqlstr& " And Fk_GBook_ReIp<>''" ElseIf Rs( "Fk_Module_GBookReply" )=2 Then Sqlstr=Sqlstr& " And (Fk_GBook_ReIp='' Or Fk_GBook_ReIp Is Null)" End If c_Rs.Open Sqlstr,Conn,1,1 c_Rs.PageSize=PageSizes If c_Rs.PageCount>0 Then PageCounts=c_Rs.PageCount End If c_Rs.Close Else PageCounts=1 End If '循环生成 For PageNow=1 To PageCounts '链接地址获取 If Rs( "Fk_Module_FixedUrl" )<> "" Then '绝对链接 If Instr(Rs( "Fk_Module_FixedUrl" ), "." )>0 Then '绝对链接带后缀 cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,Rs( "Fk_Module_Id" ),Rs( "Fk_Module_FixedUrl" )) Else '绝对链接不带后缀 If PageNow=1 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,Rs( "Fk_Module_Id" ),Rs( "Fk_Module_FixedUrl" )& "Index" ) Else cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,Rs( "Fk_Module_Id" ),Rs( "Fk_Module_FixedUrl" )& "Index_" &PageNow) End If End If Else '非绝对链接 If PageNow=1 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" ,Rs( "Fk_Module_Url" )& "Index" , "" ,PageSuffix,1,Rs( "Fk_Module_Id" ), "" ) Else cURL=FKTemplate.GetUrl(FullSiteDir, "" ,Rs( "Fk_Module_Url" )& "Index_" &PageNow, "" ,PageSuffix,1,Rs( "Fk_Module_Id" ), "" ) End If End If '生成 cURL=Replace(cURL, "Index" &PageSuffix, "" ) cURL=Server.HTMLEncode(Replace(Fk_Site_Url&cURL, "//" , "/" )) CreateHtml=CreateHtml& "<url>" &vbLf CreateHtml=CreateHtml& "<loc>" &cURL& "</loc>" &vbLf If CreateType=1 Then CreateHtml=CreateHtml& "<lastmod>" & Date ()& "</lastmod>" &vbLf CreateHtml=CreateHtml& "<changefreq>daily</changefreq>" &vbLf CreateHtml=CreateHtml& "<priority>0.7</priority>" &vbLf End If CreateHtml=CreateHtml& "</url>" &vbLf Next End If End If Rs.MoveNext Wend End If Rs.Close |
替换为以下代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
'生成栏目页 Sqlstr= "Select Fk_Module_Id,Fk_Module_Type,Fk_Module_Model,Fk_Module_FixedUrl,Fk_Module_Url,Fk_Module_LinkType,Fk_Module_PageSize,Fk_Module_Menu,Fk_Module_GBookReply,Fk_Module_Template From [Fk_Module] Where Fk_Module_State=1 Order By Fk_Module_Id Asc" mRs.Open Sqlstr,Conn,1,1 If Not mRs.Eof Then While Not mRs.Eof If (mRs( "Fk_Module_LinkType" )=1 And mRs( "Fk_Module_Type" )=4) Or Instr( ",0,2," , "," &mRs( "Fk_Module_Type" )& "," )>0 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" ,mRs( "Fk_Module_Url" )& "Index" , "" ,PageSuffix,1,mRs( "Fk_Module_Id" ),mRs( "Fk_Module_FixedUrl" )) '生成 cURL=Replace(cURL, "Index" &PageSuffix, "" ) cURL=Server.HTMLEncode(Replace(Replace(Fk_Site_Url&CURL, "//" , "/" ), "http:/" , "http://" )) CreateHtml=CreateHtml& "<url>" &vbLf CreateHtml=CreateHtml& "<loc>" &cURL& "</loc>" &vbLf If CreateType=1 Then CreateHtml=CreateHtml& "<lastmod>" & Date ()& "</lastmod>" &vbLf CreateHtml=CreateHtml& "<changefreq>daily</changefreq>" &vbLf CreateHtml=CreateHtml& "<priority>0.7</priority>" &vbLf End If CreateHtml=CreateHtml& "</url>" &vbLf ElseIf Instr( ",1,3," , "," &mRs( "Fk_Module_Type" )& "," )>0 Then '读取每页数量 PageSizes=Fk_Site_PageSize If mRs( "Fk_Module_PageSize" )>0 Then PageSizes=mRs( "Fk_Module_PageSize" ) End If '读取模型绑定模板 If mRs( "Fk_Module_Type" )=1 Then Sqlstr= "Select Fk_Model_Template From [Fk_Model] Where Fk_Model_Id=" & mRs( "Fk_Module_Model" )& "" c_Rs.Open Sqlstr,Conn,1,1 If Not c_Rs.Eof Then mModelTemplate=c_Rs( "Fk_Model_Template" ) Else mModelTemplate= "" End If c_Rs.Close Else mModelTemplate= "" End If If mRs( "Fk_Module_Type" )=1 Then PageTemplate= "viewlist" ElseIf mRs( "Fk_Module_Type" )=3 Then PageTemplate= "gbook" End If If mRs( "Fk_Module_Template" )<> "" Then PageTemplate=mRs( "Fk_Module_Template" ) ElseIf mModelTemplate<> "" Then PageTemplate=mModelTemplate End If '菜单信息读取 Sqlstr= "Select Fk_Menu_Dir,Fk_Menu_Template From [Fk_Menu] Where Fk_Menu_Id=" & mRs( "Fk_Module_Menu" ) c_Rs.Open Sqlstr,Conn,1,1 If Not c_Rs.Eof Then MenuDir=c_Rs( "Fk_Menu_Dir" ) MenuTemplate=c_Rs( "Fk_Menu_Template" ) Else c_Rs.Close Call FKFun.ShowErr( "error:菜单不存在!" ,0) End If c_Rs.Close '目录模板方案_默认模板组合 If MenuTemplate<> "" Then If Instr(DisTemplate, "," &PageTemplate& "," )>0 Then PageTemplate=MenuTemplate& "/" &PageTemplate End If End If '模板标签解析 PageCode=FKTemplate.GetTemplate(PageTemplate) PageCounts=1 '读取页数 If Instr(PageCode, "{$ModulePageCode(" )>0 Then '内容模块 If mRs( "Fk_Module_Type" )=1 Then Sqlstr= "Select Fk_View_Id From [Fk_View] Where Fk_View_Show=1 And Fk_View_Module=" &mRs( "Fk_Module_Id" )& "" c_Rs.Open Sqlstr,Conn,1,1 c_Rs.PageSize=PageSizes If c_Rs.PageCount>0 Then PageCounts=c_Rs.PageCount End If c_Rs.Close '留言模块 ElseIf mRs( "Fk_Module_Type" )=3 And mRs( "Fk_Module_GBookReply" )<>3 Then Sqlstr= "Select Fk_GBook_Id From [Fk_GBook] Where Fk_GBook_Module=" &mRs( "Fk_Module_Id" )& "" If mRs( "Fk_Module_GBookReply" )=1 Then Sqlstr=Sqlstr& " And Fk_GBook_ReIp<>''" ElseIf mRs( "Fk_Module_GBookReply" )=2 Then Sqlstr=Sqlstr& " And (Fk_GBook_ReIp='' Or Fk_GBook_ReIp Is Null)" End If c_Rs.Open Sqlstr,Conn,1,1 c_Rs.PageSize=PageSizes If c_Rs.PageCount>0 Then PageCounts=c_Rs.PageCount End If c_Rs.Close Else PageCounts=1 End If '循环生成 For PageNow=1 To PageCounts '链接地址获取 If mRs( "Fk_Module_FixedUrl" )<> "" Then '绝对链接 If Instr(mRs( "Fk_Module_FixedUrl" ), "." )>0 Then '绝对链接带后缀 cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,mRs( "Fk_Module_Id" ),mRs( "Fk_Module_FixedUrl" )) Else '绝对链接不带后缀 If PageNow=1 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,mRs( "Fk_Module_Id" ),mRs( "Fk_Module_FixedUrl" )& "Index" ) Else cURL=FKTemplate.GetUrl(FullSiteDir, "" , "" , "" ,PageSuffix,1,mRs( "Fk_Module_Id" ),mRs( "Fk_Module_FixedUrl" )& "Index_" &PageNow) End If End If Else '非绝对链接 If PageNow=1 Then cURL=FKTemplate.GetUrl(FullSiteDir, "" ,mRs( "Fk_Module_Url" )& "Index" , "" ,PageSuffix,1,mRs( "Fk_Module_Id" ), "" ) Else cURL=FKTemplate.GetUrl(FullSiteDir, "" ,mRs( "Fk_Module_Url" )& "Index_" &PageNow, "" ,PageSuffix,1,mRs( "Fk_Module_Id" ), "" ) End If End If '生成 cURL=Replace(cURL, "Index" &PageSuffix, "" ) cURL=Server.HTMLEncode(Replace(Replace(Fk_Site_Url&CURL, "//" , "/" ), "http:/" , "http://" )) CreateHtml=CreateHtml& "<url>" &vbLf CreateHtml=CreateHtml& "<loc>" &cURL& "</loc>" &vbLf If CreateType=1 Then CreateHtml=CreateHtml& "<lastmod>" & Date ()& "</lastmod>" &vbLf CreateHtml=CreateHtml& "<changefreq>daily</changefreq>" &vbLf CreateHtml=CreateHtml& "<priority>0.7</priority>" &vbLf End If CreateHtml=CreateHtml& "</url>" &vbLf Next End If End If mRs.MoveNext Wend End If mRs.Close |
保存文件,修复完成。