afterlastangel
Donkey Kong
- 3/11/04
- 398
- 0
Nguồn dịch http://home.att.net/~codeLibrary/XML/rss.htm
Tạo 1 file ASP như vầy. Có thể ở file header
<%
Sub getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("news.xsl")
set source = Server.CreateObject("Msxml2.DomDocument")
source.async = false
source.setProperty "ServerHTTPRequest", true
source.load CStr(sourceFile)
set style = Server.CreateObject("Msxml2.DomDocument")
style.async = false
style.load styleFile
source.transformNodeToObject style, Response
set source = nothing
set style = nothing
End Sub
%>
Sau đó down load cái này về để vào thư mục của file vừa tạo ttp://home.att.net/~codeLibrary/XML/news.xsl (bấm phải save as)
Sau đó để dòng này vào nơi muốn hiện thông tin lên.
<% getXML("Link của RSS") %>
Địa chỉ của RSS mà mình lấy có thể lấy trên các tờ báo online như tuổi trẻ hay người lao động ở đây mình để vài link
Thời sự
http://www.nld.com.vn/rss/thoi-su.xml
Du lịch
http://www.nld.com.vn/rss/du-lich.xml
Thể thao
http://www.nld.com.vn/rss/the-thao.xml
Tin học
http://www.nld.com.vn/rss/tin-hoc.xml
Muốn biết thông tin mấy link này bạn chỉ cần vào trang web và kiếm chữ RSS và bấm vào nó. Vậy là bạn đã có 1 trang thông tin tự động cập nhật đầy đủ và tin cậy trên trang web của bạn rồi đó.
Bài tiếp theo có thể mình sẽ giới thiệu về việt hoá dự báo thời tiết tại Yahoo
Tạo 1 file ASP như vầy. Có thể ở file header
<%
Sub getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("news.xsl")
set source = Server.CreateObject("Msxml2.DomDocument")
source.async = false
source.setProperty "ServerHTTPRequest", true
source.load CStr(sourceFile)
set style = Server.CreateObject("Msxml2.DomDocument")
style.async = false
style.load styleFile
source.transformNodeToObject style, Response
set source = nothing
set style = nothing
End Sub
%>
Sau đó down load cái này về để vào thư mục của file vừa tạo ttp://home.att.net/~codeLibrary/XML/news.xsl (bấm phải save as)
Sau đó để dòng này vào nơi muốn hiện thông tin lên.
<% getXML("Link của RSS") %>
Địa chỉ của RSS mà mình lấy có thể lấy trên các tờ báo online như tuổi trẻ hay người lao động ở đây mình để vài link
Thời sự
http://www.nld.com.vn/rss/thoi-su.xml
Du lịch
http://www.nld.com.vn/rss/du-lich.xml
Thể thao
http://www.nld.com.vn/rss/the-thao.xml
Tin học
http://www.nld.com.vn/rss/tin-hoc.xml
Muốn biết thông tin mấy link này bạn chỉ cần vào trang web và kiếm chữ RSS và bấm vào nó. Vậy là bạn đã có 1 trang thông tin tự động cập nhật đầy đủ và tin cậy trên trang web của bạn rồi đó.
Bài tiếp theo có thể mình sẽ giới thiệu về việt hoá dự báo thời tiết tại Yahoo