Help changing RSS feed window target | Member | | Join Date: Apr 2009
Posts: 36
| |
I have an RSS reader that I have been using, but the only problem i have is that I want the target to be "_blank" rather than the parent window.
Anyone know where I should add the _blank? - <html>
-
<link href="rss.css" rel="stylesheet" type="text/css"/>
-
<body>
-
-
<%
-
Response.Expires = -1
-
-
' =========== RSS2HTML.ASP for ASP/ASP.NET ==========
-
' copyright 2005-2008 (c) www.Bytescout.com
-
' version 1.27, 17 August 2008
-
' =========== configuration =====================
-
' ##### URL to RSS Feed to display #########
-
URLToRSS = "http://rss.cnn.com/rss/cnn_topstories.rss"
-
-
' ##### max number of displayed items #####
-
MaxNumberOfItems = 10
-
-
' ##### Main template constants
-
MainTemplateHeader = "<table>"
-
MainTemplateFooter = "</table>"
-
' #####
-
-
' ######################################
-
Keyword1 = "" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword
-
Keyword2 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too
-
' #################################
-
-
' ##### Item template.
-
' ##### {LINK} will be replaced with item link
-
' ##### {TITLE} will be replaced with item title
-
' ##### {DESCRIPTION} will be replaced with item description
-
' ##### {DATE} will be replaced with item date and time
-
' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog)
-
' ##### {CATEGORY} will be replaced with item category
-
ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
-
-
' ##### Error message that will be displayed if not items etc
-
ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"
-
-
' ================================================
-
-
Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
-
xmlHttp.Open "GET", URLToRSS, false
-
xmlHttp.Send()
-
RSSXML = xmlHttp.ResponseText
-
-
Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
-
xmlDOM.async = False
-
xmlDOM.validateOnParse = False
-
xmlDom.resolveExternals = False
-
-
If not xmlDOM.LoadXml(RSSXML) Then
-
ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage
-
End If
-
-
Set xmlHttp = Nothing ' clear HTTP object
-
-
Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS
-
-
RSSItemsCount = RSSItems.Length-1
-
-
' if not <item>..</item> entries, then try to get <entry>..</entry>
-
if RSSItemsCount = -1 Then
-
Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS
-
RSSItemsCount = RSSItems.Length-1
-
-
End If
-
-
Set xmlDOM = Nothing ' clear XML
-
-
-
' writing Header
-
if RSSItemsCount > 0 then
-
Response.Write MainTemplateHeader
-
End If
-
-
j = -1
-
-
For i = 0 To RSSItemsCount
-
Set RSSItem = RSSItems.Item(i)
-
-
' fix for the issue when a description from a previous item
-
' is used if current item description is empty provided by George Sexton
-
RSSdescription=" "
-
RSSCommentsLink=" "
-
-
for each child in RSSItem.childNodes
-
-
Select case lcase(child.nodeName)
-
case "title"
-
RSStitle = child.text
-
case "link"
-
If child.Attributes.length>0 Then
-
RSSLink = child.GetAttribute("href")
-
if (RSSLink <> "") Then
-
if child.GetAttribute("rel") <> "alternate" Then
-
RSSLink = ""
-
End If
-
End If
-
End If ' if has attributes
-
If RSSLink = "" Then
-
RSSlink = child.text
-
End If
-
case "description"
-
RSSdescription = child.text
-
case "content" ' atom format
-
RSSdescription = child.text
-
case "published"' atom format
-
RSSDate = child.text
-
case "pubdate"
-
RSSDate = child.text
-
case "comments"
-
RSSCommentsLink = child.text
-
case "category"
-
Set CategoryItems = RSSItem.getElementsByTagName("category")
-
RSSCategory = ""
-
for each categoryitem in CategoryItems
-
if RSSCategory <> "" Then
-
RSSCategory = RSSCategory & ", "
-
End If
-
-
RSSCategory = RSSCategory & categoryitem.text
-
Next
-
End Select
-
next
-
-
' now check filter
-
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)
-
ItemContent = Replace(ItemContent,"{DATE}",RSSDate)
-
ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)
-
ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)
-
-
Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
-
ItemContent = ""
-
RSSLink = ""
-
End if
-
End If
-
-
Next
-
-
' writing Footer
-
if RSSItemsCount > 0 then
-
Response.Write MainTemplateFooter
-
else
-
Response.Write ErrorMessage
-
End If
-
-
' Response.End ' uncomment this for use in on-the-fly output
-
%>
-
-
-
<hr>
-
<p> </p>
-
</body>
-
</html>
-
-
-
| | Newbie | | Join Date: Nov 2009
Posts: 1
| | | re: Help changing RSS feed window target
I've used this code before. The page is building XML. The <link> tag is just a URL, not HTML so there is no target to add. Where the page opens (parent, new window, new tab) is up to the user or their browser settings. I guess you could duplicate the link the description of the item. In there you can use standard html and just add an href with a specific target attribute.
|  | Moderator | | Join Date: Jan 2007 Location: logan, utah
Posts: 2,690
| | | re: Help changing RSS feed window target
you could force the issue by opening a new page on the step before this.
| | Member | | Join Date: Apr 2009
Posts: 36
| | | re: Help changing RSS feed window target Quote:
Originally Posted by jhardman you could force the issue by opening a new page on the step before this. Would you mind expanding on this for me? What should i do to force it?
| Similar ASP / Active Server Pages bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|