I have a problem displaying some text on an ASP page.
My page pulls articles from a db. The last 5 articles in my db are displayed in descending order on my ASP page. Some of the articles are rather long and are written to the browser as follows:
strTitle = objRS("Title"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strStory = objRS("Story"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strLink = objRS("Link"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strSubmittedBy = objRS("SubmittedBy"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strDatestamp = objRS("Datestamp"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Response.Write "<p><a name='" & numCounter & "'></a><b>"
Response.Write strTitle
Response.Write "</b><br>"
##Response.Write strStory
Response.Write "<br><br>"
Response.Write "Link: <a href='" & strLink & "' target='_new'>" & strLink & "</a>"
Response.Write "<br>"
Response.Write "<small>Submitted by "
Response.Write strSubmittedBy
Response.Write " on "
Response.Write strDatestamp
Response.Write "</small></p>"
Response.Write "<hr width='75%'>"
numCounter = numCounter + 1
objRS.MovePrevious
Loop
objRS.Close
'objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
Because some of the articles are long, I want clean up the page by limiting the amount of text that displays to 150-200 characters.
I've tried to alter my code by eliminating the line of code I've notated with '##' (above) with several variations of this code:
Response.Write Left(Trim((strStory).value), 150)
if Len(Trim((strStory).value)) > 150)
Response.Write "...<a href='showstory.asp?storyid=" & numID & "'>Full Story>>>"
Response.Write "<br><br>"
I was hoping to limit the article to 150 characters and provide a link to the full article with "Full Story>>>"
The closest I've come to success has been to write the first article Headline and the following error:
Microsoft VB Script Runtime Error '800a01a8'
Object required: '[string:"<p>A small snippet of article text here"]'
line 59
where line 59 is:
Response.Write Left(Trim((strStory).value), 150)
I'm confused but I'm wondering if the error is being produced because of the way that my articles are submitted to the db...
I submit articles to the db via web form. The text in the web form includes HTML formatting tags such as <p> <b> etc. Could this error occur because I'm trimming my text down to 150 characters and by doing so am producing a string of text (that I want to display in a condensed form) but it's missing the </p> tag?
If anyne can help me with the code, or suggest some alternatives to achieve the same end (partial articles with links to full article) I'd be very appreciative.
This line of code sucesfully produces an ASP page (showstory.asp) with the full article:
Response.Write "...<a href='showstory.asp?storyid=" & numID & "'>"
So close and yet so far...
Thanks in advance.
and I want to limit the amount of displayed text to a couple of hundred characters or so.
My page pulls articles from a db. The last 5 articles in my db are displayed in descending order on my ASP page. Some of the articles are rather long and are written to the browser as follows:
strTitle = objRS("Title"
strStory = objRS("Story"
strLink = objRS("Link"
strSubmittedBy = objRS("SubmittedBy"
strDatestamp = objRS("Datestamp"
Response.Write "<p><a name='" & numCounter & "'></a><b>"
Response.Write strTitle
Response.Write "</b><br>"
##Response.Write strStory
Response.Write "<br><br>"
Response.Write "Link: <a href='" & strLink & "' target='_new'>" & strLink & "</a>"
Response.Write "<br>"
Response.Write "<small>Submitted by "
Response.Write strSubmittedBy
Response.Write " on "
Response.Write strDatestamp
Response.Write "</small></p>"
Response.Write "<hr width='75%'>"
numCounter = numCounter + 1
objRS.MovePrevious
Loop
objRS.Close
'objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
Because some of the articles are long, I want clean up the page by limiting the amount of text that displays to 150-200 characters.
I've tried to alter my code by eliminating the line of code I've notated with '##' (above) with several variations of this code:
Response.Write Left(Trim((strStory).value), 150)
if Len(Trim((strStory).value)) > 150)
Response.Write "...<a href='showstory.asp?storyid=" & numID & "'>Full Story>>>"
Response.Write "<br><br>"
I was hoping to limit the article to 150 characters and provide a link to the full article with "Full Story>>>"
The closest I've come to success has been to write the first article Headline and the following error:
Microsoft VB Script Runtime Error '800a01a8'
Object required: '[string:"<p>A small snippet of article text here"]'
line 59
where line 59 is:
Response.Write Left(Trim((strStory).value), 150)
I'm confused but I'm wondering if the error is being produced because of the way that my articles are submitted to the db...
I submit articles to the db via web form. The text in the web form includes HTML formatting tags such as <p> <b> etc. Could this error occur because I'm trimming my text down to 150 characters and by doing so am producing a string of text (that I want to display in a condensed form) but it's missing the </p> tag?
If anyne can help me with the code, or suggest some alternatives to achieve the same end (partial articles with links to full article) I'd be very appreciative.
This line of code sucesfully produces an ASP page (showstory.asp) with the full article:
Response.Write "...<a href='showstory.asp?storyid=" & numID & "'>"
So close and yet so far...
Thanks in advance.
and I want to limit the amount of displayed text to a couple of hundred characters or so.