Getting a simple RSS feed on my site??

Discussion in 'Programming' started by tridean, Oct 1, 2006.

  1. #1
    Hi All,
    I was hoping to get some help from a code guru.

    I want a simple RSS feed on my web site. I don't know yet whether I want it on all pages (therefore in one of the side navigations) or just on the home page, but I only want a simple thing that can be seen here at this link

    http://www.oakwebworks.com/

    It is down the bottom of the right hand side navigation under the heading 'Latest Tech News'

    I found some help with getting a PHP script installed on my server, however because my site is in html I really don't know how to do it.

    Is PHP the better way to go or should I be looking at ASP or something. I don't want to use Javascript.

    My other problem is that unless I get step by step instructions for dummies I'm useless.

    Cheers
    Dean
     
    tridean, Oct 1, 2006 IP
  2. shaileshk

    shaileshk Well-Known Member

    Messages:
    455
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    <%
    
    url=Request.Form("cmbcat")
    nonews=Request.Form("cmptot")
    tblborder=Request.Form("tblborder")
    tblwidth=Request.Form("tblwidth")
    tblwidthtype=Request.Form("tblwidthtype")
    tblbgcolor=Request.Form("tblbgcolor")
    brdcolor=Request.Form("brdcolor")
    tblpadding=Request.Form("tblpadding")
    
    tblspacing=Request.Form("tblspacing")
    tblalign=Request.Form("tblalign")
    newstype=Request.Form("newstype")
    Response.Write("<BR>")
    Response.Write(getNews(url,nonews,newstype,tblborder,tblwidth,tblwidthtype,tblbgcolor,brdcolor,tblspacing,tblpadding,tblAlign))
    
    Response.Write("getNews(")
    Response.Write(url&","&nonews&","&newstype&","&tblborder&","&tblwidth&","&tblwidthtype&","&tblbgcolor&","&brdcolor&","&tblspacing&","&tblpadding&","&tblAlign&")")
    
    
    
    function getNews(url,nonews,newstype,tblborder,tblwidth,tblwidthtype,tblbgcolor,brdcolor,tblspaceing,tblpadding,tblAlign)
    
    Response.Expires = -1
    
    URLToRSS = url
    
    
    MaxNumberOfItems = nonews
    
    
    MainTemplateHeader = "<table "
    
    if tblborder<>"" then
    MainTemplateHeader=MainTemplateHeader&" border="&tblborder
    end if
    if tblwidth<>"" then
    MainTemplateHeader=MainTemplateHeader&" width="&tblwidth&""&tblwidthtype&""
    end if
    if tblbgcolor<>"" then
    MainTemplateHeader=MainTemplateHeader&" bgcolor="&tblbgcolor
    end if
    if brdcolor<>"" then
    MainTemplateHeader=MainTemplateHeader&" bordercolor="&brdcolor
    end if
    if tblpadding<>"" then
    MainTemplateHeader=MainTemplateHeader&" cellpadding="&tblpadding
    end if
    
    if tblspacing<>"" then
    MainTemplateHeader=MainTemplateHeader&" cellspacing="&tblspacing
    end if
    if tblalign<>"" then
    MainTemplateHeader=MainTemplateHeader&" align="&tblalign
    end if
    
    
    
    
    MainTemplateHeader=MainTemplateHeader&">"
    
    MainTemplateFooter = "</table>"
    
    'temTemplate1 = "<tr><td><a href=" & """{LINK}""" & " target=" & chr(34) & "_blank" & chr(34) & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
    
    temTemplate1 = "<tr><td>"
    temTemplate2="</td></tr>"
    
    
    
    
    ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"
    
    Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0")
    xmlHttp.Open "Get", URLToRSS, false
    xmlHttp.Send()
    RSSXML = xmlHttp.ResponseText
    
    Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
    xmlDOM.async = false
    xmlDOM.LoadXml(RSSXML)
    
    Set xmlHttp = Nothing ' clear HTTP object
    
    Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS
    Set RSStitle = xmlDOM.getElementsByTagName("title")
    
    rssTitle=RSStitle.item(0).text
    MainTableHeader="<th>"&rssTitle&"</th>"
    
    Set xmlDOM = Nothing ' clear XML
    
    RSSItemsCount = RSSItems.Length-1
    
    
    if RSSItemsCount > 0 then 
    Response.Write MainTemplateHeader
    Response.Write MainTableHeader
    End If
    
    j = -1
    
    For i = 0 To RSSItemsCount
    Set RSSItem = RSSItems.Item(i)
    
    for each child in RSSItem.childNodes
    Select case lcase(child.nodeName)
    case "title"
    RSStitle = child.text
    case "link"
    RSSlink = child.text
    case "description"
    RSSdescription = child.text
    End Select
    next
    If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then
    j = J+1
    if J< cint(nonews) then 
    Response.Write(temTemplate1)
    Response.Write("<b><a href="&RSSlink&">")
    Response.Write(RSStitle)
    Response.Write("</a></b>")
    if newstype="1" then
    Response.Write(RSSDescription)
    end if
    Response.Write(temTemplate2)
    
    End if
    End If 
    
    Next
    
    if RSSItemsCount > 0 then 
    Response.Write MainTemplateFooter
    else 
    Response.Write ErrorMessage
    End If
    end function
    %>
    
    Code (markup):
     
    shaileshk, Oct 2, 2006 IP
  3. tridean

    tridean Guest

    Messages:
    285
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks
    I actually found a web site that allows you to enter in all sorts of data and it spits out a php script. It also gives instructions on how to use php on html pages without having to change the ext to php
     
    tridean, Oct 2, 2006 IP
  4. Xth Cannon

    Xth Cannon Banned

    Messages:
    352
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Xth Cannon, Oct 2, 2006 IP
  5. jbladeus

    jbladeus Peon

    Messages:
    485
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    can you post its link please. Thanks.
     
    jbladeus, Oct 2, 2006 IP
  6. trojan

    trojan Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes pls post the link
    I would like to add a some dynamic news to my site as well
    tq
     
    trojan, Oct 4, 2006 IP
  7. tridean

    tridean Guest

    Messages:
    285
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    tridean, Oct 4, 2006 IP