Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write HTML code within ASP line

Status
Not open for further replies.

penguinspeaks

Technical User
Nov 13, 2002
234
US
trying to use ASP code that I recently wrote to split data into columns instead of just one. The problem I'm running into is what I went to enter HTML code into said data.
Here's the HTML code that II have
Code:
SET INFO1 = CONN.EXECUTE("SELECT * from videos order by ID DESC")
VLINK = INFO1("LINK_")
VRELEASE = INFO1("RELEASE_DATE_")
VTHUMB = INFO1("THUMB_ADDRESS_")
VTITLE = INFO1("EPISODE_TITLE_")
VBLURB = INFO1("EPISODE_BLURB_")
VLINK1 = "[URL unfurl="true"]https://totem-pole.ferrens.info/img/thumbs/"[/URL]
iITEMSPerRow = 4 

iItems = CINT(cnt1)

strDISPLAY = ""

For i = 1 to iItems

If i mod iITEMSPerRow = 1 Then strDISPLAY = strDISPLAY & "<tr>"

strDISPLAY = strDISPLAY & "<td>" & i & "</td>"


If i mod iITEMSPerRow = 0 Then 
strDISPLAY = strDISPLAY & "</tr>"
END IF
Next

strDISPLAY = strDISPLAY & ""

Response.write(strDISPLAY) %>
right now, When the variable i is used, it just shows numbers because that's what the code tells it to do. It counts the records shows the number of records, IF IT'S DIVISIBLE BY FOUR it does something if it's not divisible by four does something else.
I want to put an image. Of course, the image is determined by the result from the database.
This is what I want the code to look like,, or should I say enter into the code
Code:
<img height="69" src="<%=VLINK1%><%=VTHUMB1%>" width="123" />

my issue is, I don't know how to make HTML and ASP work together.
And what I mean is in the same line of code. I can make a them work together on pages, but I don't know how to code them together into one line.
And as you can see they need too be in the same line for this code to work.

. How do I make this line of code, which contains both HTML and classic ASP work in a single line of ASP code??

the latest I have tried is the following:
Code:
Code:
strDISPLAY = strDISPLAY & "<td>"%><img src="img/thumbs/EPISODE-<%=info1("VID")%>-THUMB-WEB.png" /><%"</td>"
Microsoft VBScript compilation error '800a0400'

Expected statement

/episodes.ASP, line 77

"</td>"
^

line 77 Code is this
Code:
strDISPLAY = strDISPLAY & "<td>" & i & "</td>"
I am still lost their. I have tried other things, and they still don't give me the results I want. I am not sure what else to do


Thanks,
Penguin
Please keep in mind that I am using classic ASP with MySQL database.

"It's nice to be important... but it's more important to be nice.
 
Not sure what the %> <% are for but they are syntactically incorrect
Code:
strDISPLAY = strDISPLAY & "<td>"%><img src="img/thumbs/EPISODE-<%=info1("VID")%>-THUMB-WEB.png" /><%"</td>"

I think that should read
Code:
strDISPLAY = strDISPLAY & "<td><img src="img/thumbs/EPISODE-<%=info1("VID")%>-THUMB-WEB.png" /></td>"

but the problem is you have quotes within quotes. You could recode it as
Code:
strDISPLAY = strDISPLAY & "<td><img src=""img/thumbs/EPISODE-" & info1("VID") & "-THUMB-WEB.png"" /></td>"

Alternatively, as a web page in HTML, you could use
Code:
<td><img src="img/thumbs/EPISODE-<%=info1("VID")%>-THUMB-WEB.png" /></td>
When the server serves the page, it will fill in <%=info1("VID")%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top