View Full Version : String error message
SteveH
07-24-2008, 10:24 AM
Hello
I am getting an 'Unterminated string constant' error:
Test.asp, line 30:
& "<span style=""font-family: tahoma; font-size: 10pt; font-weight: bold;""> _
------------------------------------------------------------------------------^
The relevant lines in the Asp file itself are:
strHTML = strHTML & "<li><a href=""" & Server.HTMLEncode(link) & """>" _
& "<span style=""font-family: tahoma; font-color: 123456; font-size: 10pt; font-weight: bold;""> _
& Server.HTMLEncode(title) & "</span>" _
strHTML = strHTML & "</a>"
strHTML = strHTML & "<br>"I thought an underscore was necessary when changing to another line?
Thanks for any help.
Steve
brazenskies
07-24-2008, 02:13 PM
you would need to use '& _'
Also you have double quotes at the href and 'span style='. These double quotes are breaking the line up.
Replace them with single quotes...
strHTML = strHTML & "<li><a href='" & Server.HTMLEncode(link) & "'>" & _
"<span style='font-family: tahoma; font-color: 123456; font-size:"& _
"10pt; font-weight: bold;'>"&Server.HTMLEncode(title)&"</span></a><br>"
SteveH
07-25-2008, 12:51 PM
Hello brazenskies
Thanks for your post.
I think attributes take double quotes but, anyway, I have 'sort of' got the feed to work here:
http://stevehigham59.7host.com/21July/24JulyTest.asp
This is the code that does this is:
<%
'If DateDiff("h", Application("rss-html-time"), Now()) >= 2 then
Set xmlDOM = Server.CreateObject("MSXML2.DOMDocument")
xmlDOM.async = False
xmlDOM.setProperty "ServerHTTPRequest", True
xmlDOM.Load("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml")
'Get all of the <item> tags in the feed
Set itemList = xmlDOM.getElementsByTagName("item")
strHTML = strHTML & "<ul>"
'Iterate over each item
For Each item In itemList
'Parse the item children
For each child in item.childNodes
Select case lcase(child.nodeName)
case "title"
title = child.text
case "link"
link = child.text
case "description"
description = child.text
End Select
Next
'Build the HTML for each bullet item
strHTML = strHTML & "<li>"
'strHTML = strHTML & "<a href=""" & Server.URLEncode(link) & """>" _
strHTML = strHTML & "<li><a target=""_blank"" href=""" & link & """>" _
& "<span style=""font-family: tahoma; font-color: BDA0F2; font-size: 10pt; font-weight: bold;"">" _
& Server.URLEncode(title) & "</span>"
strHTML = strHTML & "</a>"
strHTML = strHTML & "<br>"
strHTML = strHTML & "</a>"
strHTML = strHTML & "<br>"
strHTML = strHTML & description
strHTML = strHTML & "<br> "
strHTML = strHTML & "</li>"
Next
strHTML = strHTML & "</ul>"
Set xmlDOM = Nothing
Set itemList = Nothing
Application.Lock
Application("rss-html") = strHTML
Application("rss-html-time") = Now()
Application.UnLock
'End if
Response.Write "&html=" & Application("rss-html")
%>
On the link above you will notice &html. This is vital because this is passed to Flash and you can see the newsfeed in my Flash movie here:
http://stevehigham59.7host.com/21July/Steve23July.html
The problem I have now is that I am lacking the format that I was hoping for which is:
Bullet Headline1
Followed by a one-line description here
Bullet Headline2
Followed by a one-line description here
Bullet Headline3
Followed by a one-line description here
How might I achieve this in my ASP script (I do not want to mess about with the Flash Action Script), which retaining the &html variable which ASP offers to Flash?
Thanks.
Steve
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.