S
Sitara Lal
Can someone please advise a simple solution for syndicating an RSS feed
(from a blog, for instance) onto a page on my site (created by FP2003)?
Thanks
(from a blog, for instance) onto a page on my site (created by FP2003)?
Thanks
Stefan B Rusynko said:The code provided has a syntax error
- which would be obvious if you added a debug line after it as:
response.write ItemTemplate
You were provided the following
ItemTemplate = "<tr><td><a target=blank href=" & """{LINK}""" &
">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
And for the replace to work it should just be
ItemTemplate = "<tr><td><a target='blank'
href='{LINK}'>{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________
| ... The modified code...
|
| <%
| Response.Expires = -1
|
|
| FEEDSRC_RSS =
| "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml"
|
|
| MaxNumberOfItems = 10 '----------set to number of entries to show from
feed
|
|
| MainTemplateHeader = "<table>"
| MainTemplateFooter = "</table>"
|
|
| Keyword1 = "BBC NEWS KEYWORD 1"
| Keyword2 = "Keyword 2 content"
|
|
| ItemTemplate = "<tr><td><a target=blank href=" & """{LINK}""" &
| ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
|
|
| ErrorMessage = "Data error from feed: " &FEEDSRC_RSS & "<BR><a
| href=""http://www.SiteName/feedback.asp"">Please inform the
webmaster.</a>"
|
|
| Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0")
| xmlHttp.Open "Get", FEEDSRC_RSS, false
| xmlHttp.Send()
| RSSXML = xmlHttp.ResponseText
|
|
| Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
| xmlDOM.async = false
| xmlDOM.LoadXml(RSSXML)
|
|
| Set xmlHttp = Nothing
|
|
| Set RSSItems = xmlDOM.getElementsByTagName("item")
| Set xmlDOM = Nothing
|
|
| RSSItemsCount = RSSItems.Length-1
|
|
| if RSSItemsCount > 0 then
| Response.Write MainTemplateHeader
| 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<MaxNumberOfItems then
| ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
| ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
| Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
| ItemContent = ""
| End if
| End If
|
|
| Next
|
|
| if RSSItemsCount > 0 then
| Response.Write MainTemplateFooter
| else
| Response.Write ErrorMessage
| End If
|
|
| %>
|
| --
| ---
| | > Hi
| >
| > I tried the asp solution and got the following error
| >
| > Error Type:
| > Microsoft VBScript compilation (0x800A03EA)
| > Syntax error
| > /inc_rss.asp, line 19, column 63
| > ItemTemplate = "<tr><td><a target=blank href=" & """{LINK}""" &
| > --------------------------------------------------------------^
| >
| > Any guidance available?
| >
| > Thanks
| > M
| >
| > --
| > ---
| > | >> Dear Sitara,
| >> I wrote the complete answer to this very question for someone else,
and I
| >> am too lazy yo do it again, so, if you wouldn't mind, please read
| >>
http://groups.google.com/group/micr...328f2/045f6b9ff3771ab5?hl=en#045f6b9ff3771ab5 -
| >> it is very simple to do. Good luck.
| >>
| >> Nicholas Savalas
| >> http://savalas.tv
| >> --
| >>
| >> | >>> Can someone please advise a simple solution for syndicating an RSS
feed
| >>> (from a blog, for instance) onto a page on my site (created by
FP2003)?
| >>> Thanks
| >>>
| >>
| >>
| >
| >
|
|
Stefan B Rusynko said:Nicolas code is not wrong,
- just cumbersome, & can be done w/ cleaner coding and unnecessary server
concatenation
(any missing quote pair is not readily obvious and can cause a code error)
Look at is as 4x2 double quotes replaced by 1x2 single quotes
href=" & " " "{LINK}" " " & "
href='{LINK}'
Plus the target tag attribute should also be delimited as
target='blank'
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________
|I have it working now, and have tried Stefan's change, both seem to work
| fine.
|
| Will be checking on MAC etc to see if either code causes display
problems.
|
| Stefan, what is the difference, can you explain single and double
quotes?
|
| Many Thanks
| M
|
|
| --
| ---
| | > Dear Metta:
| > The code is working at http://savalas.tv/template.asp - that is my RSS
| > feed in the middle - I may have goofed trying to de-personalize the
code
| > and add comments. I have added the correct & working code in the
attached
| > text file - also - it must be a valid RSS feed - check it at
| > http://feedvalidator.org/ - if it works there, this code works - your
feed
| > should resemble http://rss.news.yahoo.com/rss/world - or
| > http://savalas.tv/savalas.xml (open in notepad; I'm using xsl files to
| > make it readable in browsers). Good luck.
| > --
| > Nicholas Savalas - http://savalas.tv
| > -------------------------------------------------------
| > | >> Hi
| >>
| >> I tried the asp solution and got the following error
| >>
| >> Error Type:
| >> Microsoft VBScript compilation (0x800A03EA)
| >> Syntax error
| >> /inc_rss.asp, line 19, column 63
| >> ItemTemplate = "<tr><td><a target=blank href=" & """{LINK}""" &
| >> --------------------------------------------------------------^
| >>
| >> Any guidance available?
| >>
| >> Thanks
| >> M
| >>
| >> --
| >> ---
| >> | >>> Dear Sitara,
| >>> I wrote the complete answer to this very question for someone else,
and
| >>> I am too lazy yo do it again, so, if you wouldn't mind, please read
| >>>
http://groups.google.com/group/micr...328f2/045f6b9ff3771ab5?hl=en#045f6b9ff3771ab5 -
| >>> it is very simple to do. Good luck.
| >>>
| >>> Nicholas Savalas
| >>> http://savalas.tv
| >>> --
| >>>
| >>> | >>>> Can someone please advise a simple solution for syndicating an RSS
feed
| >>>> (from a blog, for instance) onto a page on my site (created by
FP2003)?
| >>>> Thanks
| >>>>
| >>>
| >>>
| >>
| >>
| >
| >
|
|
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.