heavenly_blue
09-30-2004, 12:15 PM
Currently I am updating a site that was created about 5 years ago. There's a lot of ASP, thankfully most of it doesn't need to be changed. On a few pages that I need to fix, there's seemingly endless Response.Write lines that make pages full of tables and deprecated html tags.
Example:
Response.Write "<table height=""100%"" width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""2""><tr bgcolor=""#ffffff""><td valign=""top"">"
Response.Write rstMain("FCCDescription") & " " & rstMain("Description")
Response.Write "</td></tr></table>"
Response.Write "</td></tr></table>"
Response.Write "</td></tr>"
Response.Write "</table>"
Response.Write "</td>"
Response.Write "</tr>"
To make things easier, I am removing all the Response.Write commands and putting all the server-side language in <% %> tags like this:
<table height="100%" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#ffffff">
<td valign="top">
<%=rstMain("FCCDescription")%> <%=rstMain("Description")%>
</td></tr></table>
</td></tr></table>
</td></tr>
</table>
</td>
</tr>
By doing this, it makes it easier for me to convert all the tables and crap into CSS.
My question is, when converting lines like this:
Response.Write rstMain("FCCDescription") & " " & rstMain("Description")
Do I have to use <%= whatever %> or <% whatever %>. I'm assuming it would be a little of both depending on what the code does. I think if it's something like an IF statement I just use <% %>, but if it's trying to display a variable I use <%= %>.
I'm pretty new to ASP and stuff, so I'm not exactly sure on this one...
Example:
Response.Write "<table height=""100%"" width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""2""><tr bgcolor=""#ffffff""><td valign=""top"">"
Response.Write rstMain("FCCDescription") & " " & rstMain("Description")
Response.Write "</td></tr></table>"
Response.Write "</td></tr></table>"
Response.Write "</td></tr>"
Response.Write "</table>"
Response.Write "</td>"
Response.Write "</tr>"
To make things easier, I am removing all the Response.Write commands and putting all the server-side language in <% %> tags like this:
<table height="100%" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#ffffff">
<td valign="top">
<%=rstMain("FCCDescription")%> <%=rstMain("Description")%>
</td></tr></table>
</td></tr></table>
</td></tr>
</table>
</td>
</tr>
By doing this, it makes it easier for me to convert all the tables and crap into CSS.
My question is, when converting lines like this:
Response.Write rstMain("FCCDescription") & " " & rstMain("Description")
Do I have to use <%= whatever %> or <% whatever %>. I'm assuming it would be a little of both depending on what the code does. I think if it's something like an IF statement I just use <% %>, but if it's trying to display a variable I use <%= %>.
I'm pretty new to ASP and stuff, so I'm not exactly sure on this one...