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>
-
-
-
4 3058
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.
jhardman 3,406
Recognized Expert Specialist
you could force the issue by opening a new page on the step before this.
@jhardman
Would you mind expanding on this for me? What should i do to force it?
You add the target blank in the ItemTemplate bit line 35:
so where you have this: -
ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
-
you add in the a href part: - ItemTemplate = "<tr><td><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & " target='_blank'>{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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');">
|
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">
|
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...
|
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...
|
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
| |
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...
|
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...
|
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...
|
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...
|
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. ...
|
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...
| |
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |