473,586 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help changing RSS feed window target

49 New Member
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?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <link href="rss.css" rel="stylesheet" type="text/css"/>
  3. <body>
  4.  
  5. <%
  6. Response.Expires = -1
  7.  
  8. ' =========== RSS2HTML.ASP for ASP/ASP.NET ==========
  9. ' copyright 2005-2008 (c) www.Bytescout.com
  10. ' version 1.27, 17 August 2008
  11. ' =========== configuration =====================
  12. ' ##### URL to RSS Feed to display #########
  13. URLToRSS = "http://rss.cnn.com/rss/cnn_topstories.rss"
  14.  
  15. ' ##### max number of displayed items #####
  16. MaxNumberOfItems = 10
  17.  
  18. ' ##### Main template constants
  19. MainTemplateHeader = "<table>"
  20. MainTemplateFooter = "</table>"
  21. ' #####
  22.  
  23. ' ######################################
  24. Keyword1 = "" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword
  25. Keyword2 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too
  26. ' #################################
  27.  
  28. ' ##### Item template.
  29. ' ##### {LINK} will be replaced with item link
  30. ' ##### {TITLE} will be replaced with item title
  31. ' ##### {DESCRIPTION} will be replaced with item description
  32. ' ##### {DATE} will be replaced with item date and time
  33. ' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog)
  34. ' ##### {CATEGORY} will be replaced with item category
  35. ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
  36.  
  37. ' ##### Error message that will be displayed if not items etc
  38. ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"
  39.  
  40. ' ================================================
  41.  
  42. Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
  43. xmlHttp.Open "GET", URLToRSS, false
  44. xmlHttp.Send()
  45. RSSXML = xmlHttp.ResponseText
  46.  
  47. Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
  48. xmlDOM.async = False
  49. xmlDOM.validateOnParse = False
  50. xmlDom.resolveExternals = False
  51.  
  52. If not xmlDOM.LoadXml(RSSXML) Then
  53. ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage
  54. End If
  55.  
  56. Set xmlHttp = Nothing ' clear HTTP object
  57.  
  58. Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS
  59.  
  60. RSSItemsCount = RSSItems.Length-1
  61.  
  62. ' if not <item>..</item> entries, then try to get <entry>..</entry>
  63. if RSSItemsCount = -1 Then
  64. Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS
  65. RSSItemsCount = RSSItems.Length-1
  66.  
  67. End If
  68.  
  69. Set xmlDOM = Nothing ' clear XML
  70.  
  71.  
  72. ' writing Header
  73. if RSSItemsCount > 0 then
  74. Response.Write MainTemplateHeader
  75. End If
  76.  
  77. j = -1
  78.  
  79. For i = 0 To RSSItemsCount
  80. Set RSSItem = RSSItems.Item(i)
  81.  
  82. ' fix for the issue when a description from a previous item 
  83. ' is used if current item description is empty provided by George Sexton
  84. RSSdescription="&nbsp;" 
  85. RSSCommentsLink="&nbsp;"
  86.  
  87. for each child in RSSItem.childNodes
  88.  
  89. Select case lcase(child.nodeName)
  90. case "title"
  91. RSStitle = child.text
  92. case "link"
  93. If child.Attributes.length>0 Then
  94. RSSLink = child.GetAttribute("href")
  95. if (RSSLink <> "") Then
  96. if child.GetAttribute("rel") <> "alternate" Then
  97. RSSLink = ""
  98. End If
  99. End If
  100. End If ' if has attributes
  101. If RSSLink = "" Then
  102. RSSlink = child.text
  103. End If
  104. case "description"
  105. RSSdescription = child.text
  106. case "content" ' atom format
  107. RSSdescription = child.text
  108. case "published"' atom format
  109. RSSDate = child.text
  110. case "pubdate"
  111. RSSDate = child.text
  112. case "comments"
  113. RSSCommentsLink = child.text
  114. case "category"
  115. Set CategoryItems = RSSItem.getElementsByTagName("category")
  116. RSSCategory = ""
  117. for each categoryitem in CategoryItems
  118. if RSSCategory <> "" Then
  119. RSSCategory = RSSCategory & ", "
  120. End If
  121.  
  122. RSSCategory = RSSCategory & categoryitem.text
  123. Next
  124. End Select
  125. next
  126.  
  127. ' now check filter
  128. If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then
  129.  
  130. j = J+1
  131.  
  132. if J<MaxNumberOfItems then
  133. ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
  134. ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
  135. ItemContent = Replace(ItemContent,"{DATE}",RSSDate)
  136. ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)
  137. ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)
  138.  
  139. Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
  140. ItemContent = ""
  141. RSSLink = ""
  142. End if
  143. End If
  144.  
  145. Next
  146.  
  147. ' writing Footer
  148. if RSSItemsCount > 0 then
  149. Response.Write MainTemplateFooter
  150. else
  151. Response.Write ErrorMessage
  152. End If
  153.  
  154. ' Response.End ' uncomment this for use in on-the-fly output
  155. %>
  156.  
  157.  
  158. <hr>
  159. <p>&nbsp;</p>
  160. </body>
  161. </html>
  162.  
  163.  
  164.  
Nov 2 '09 #1
4 3058
ArsenalCanada
1 New Member
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.
Nov 3 '09 #2
jhardman
3,406 Recognized Expert Specialist
you could force the issue by opening a new page on the step before this.
Nov 3 '09 #3
jrod11
49 New Member
@jhardman
Would you mind expanding on this for me? What should i do to force it?
Nov 9 '09 #4
brookiepie
1 New Member
You add the target blank in the ItemTemplate bit line 35:

so where you have this:
Expand|Select|Wrap|Line Numbers
  1. ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
  2.  
you add in the a href part:
Expand|Select|Wrap|Line Numbers
  1. ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & " target='_blank'>{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
  2.  
I've just tried this myself and it seems to work.



Now I have a question about this same script: The feed I am adding doesn't have excerpts so they are showing up on the site with full entire entries. Is there anyway I can modify this script just to show the first few sentences/first paragraph - make the feed cut after a certain length and add ... or something?

Thanks
Nov 19 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
24528
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('', this.target, 'dialog,modal,scrollbars=yes,resizable=no,width=300,height=200,left=362,top=284');">
14
2491
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only. For example, here is the main page: <html> <head> <script type="text/javascript">
2
3872
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it...
3
2459
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a button inside a-tag with attribute target isn't anything new relating ASP.Net, its same old HTML). He claimed that you could change another page´s...
0
5546
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
5
3683
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually for repeated html im using the external js, i mean the TOP, BOTTOM they are repeated in every page, so i include them as functions in the external...
8
2332
by: Greg C. | last post by:
I tried tackling this problem about 6 months ago, but after going almost completely insane I gave up, since my news feed seemed to display just fine anyways. However, in an effort to have my feeds in complete compliance, I am trying to deal with the problem again. When I try to validate my feeds I get the following error: Line 17, column...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.