Question

Adding a Column to an ASP Script and Deleting Some if Statements

Asked by: coreybryant

Currently I have the script below that I am working with.  (I have not "updated" it to 'better' HTML yet, I just wanted to get this post out there.

Lines 4 - 11:
      if Rec("hotLink") = 1 then
            strRsp =  strRsp & "<font style=""font-size:16px"">"
            else
            strRsp =  strRsp & "<font style=""font-size:14px"">"            
      end if

      strRsp = strRsp & ("<a href="""& appUrl &"/links/"& Rec("linkID") & ".asp"">")
      strRsp = strRsp & (Rec("linkName") & "</a></font></b>" & vbnewline )

I really do not need, I just would like that to be an <h3> tag.   I know I could do:
      if Rec("hotLink") = 1 then
            strRsp =  strRsp & "<h3>"
            else
            strRsp =  strRsp & "<h3>"            
      end if

      strRsp = strRsp & ("<a href="""& appUrl &"/links/"& Rec("linkID") & ".asp"">")
      strRsp = strRsp & (Rec("linkName") & "</a></h3>" & vbnewline )

but I was hoping for something maybe a little bit cleaner if there are any ideas.

Right now, the code below creates two columns.  I would like to create three columns.

Basically broken down, the code creates something like:
<table style="width: 99%; border-collapse:collapse">
      <tr>
            <td style="width:60%; text-align:left">linkName</td>
            <td style="width:70px; text-align:right">image</td>
      </tr>
</table>

But I would like something like:
<table style="width: 99%; border-collapse:collapse">
      <tr>
            <td style="width:60%; text-align:left">linkName</td>
            <td style="text-align:left">sponsor</td>
            <td style="width:70px; text-align:right">image</td>
      </tr>
</table>


Thanks!

strRsp = strRsp & ("<table id=""tbl_func_dir144"" style=""border:0px; border-collapse:collapse; width:100%; text-align:right; background-color:#abcadc;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td style=""padding:4px; border-bottom:1px #111111 solid; width:60%; background-color:#c3d9e6; text-align:right;"">" & vbNewLine )
	if Rec("hotLink") = 1 then 
		strRsp =  strRsp & "<h3>"
		else
		strRsp =  strRsp & "<h3>"		
	end if
 
	strRsp = strRsp & ("<a href="""& appUrl &"/links/"& Rec("linkID") & ".asp"">")
	strRsp = strRsp & (Rec("linkName") & "</a></h3>" & vbnewline )
	if Rec("hotLink") = 1 then 
	strRsp =  strRsp & "<font style=""font-size:8pt"">"		
	strRsp = strRsp & ("&nbsp;<sup>[<font color=""#cc0000"">sponsor</font>]</sup></font>")
	end if
 
	if Rec("submitDate") > date - 5 then	
		strRsp = strRsp &  "&nbsp;&nbsp;<img border=""0"" src="""& appUrl &"/images/new.gif"">"
	end if
 
	strRsp = strRsp & ("</td><td style=""padding:4px; border-bottom:1px #111111 solid; background-color:#c3d9e6; width:70px; text-align:right"">")
	strRsp = strRsp & (" <b>&nbsp;" & vbNewLine )
			if Rec("cVotes") = 0 then
				rating = 0 
			else
				rating = cint(Rec("Rating") / Rec("cVotes")) 
			end if
	strRsp = strRsp &  ("<a href=""javascript:openWindowRating('"& appUrl &"/rate.asp?linkID=" & Rec("linkID")& "')"">")
	strRsp = strRsp &  ("<img src="""& appUrl & "/images/star_"& rating & ".gif"" border=""0""></a>" & vbnewline)
 
	strRsp = strRsp & ("</td>" & vbnewline )
	strRsp = strRsp & ("</tr></table>" & vbnewline )

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-10 at 07:23:46ID24721429
Topics

Active Server Pages (ASP)

,

Web Languages/Standards

Participating Experts
1
Points
500
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Add a h2 or h3 from middle frame
    I have 3 frames. From middle frame I need to add a line to the top frame. How do I do that ? I tried middle.asp function writetotop() { window.parent.frames(0).document.subhead3.outerHTML=("<p id=newpar><u><%=getname(idealid)%></u><...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: hieloPosted on 2009-09-10 at 10:44:07ID: 25302549

read the comments in the code.

'first get the "computed" values that you want to display on the browser
Dim rating, sponsor
rating = 0 
If Rec("cVotes") <> 0 Then
	rating = cint(Rec("Rating") / Rec("cVotes")) 
End If
 
sponsor=""
If Rec("hotLink") = 1 Then
	sponsor="<font style='font-size:8pt'> <sup>[<font color='#cc0000'>sponsor</font>]</sup></font>"
End If
 
submitDate=""
If Rec("submitDate") > date - 5 Then
	submitDate="  <img border='0' src='#URL#/images/new.gif'>"
End If
 
 
 
'second create a "template" with temporary "#tokens#" as placeholders for the real data
Dim template,table
template= "<table style='width: 99%; border-collapse:collapse'>" & _
      	"<tr>" & _
           	"<td style='width:60%; text-align:left'><h3><a href='#URL#/links/#LINK_ID#.asp'>#LINK_NAME#</a></h3></td>" & _
            	"<td style='text-align:left'>#SPONSOR# #SUBMIT_DATE#</td>" & _
            	"<td style='width:70px; text-align:right;'><strong><a href='#' onclick=""javascript:openWindowRating('#URL#/rate.asp?linkID=#LINK_ID#');""><img src='#URL#/images/star_#RATING#.gif' border='0'></a></strong></td>" & _
      	"</tr>" & _
	  "</table>"
 
'then replace the #tokens# with the real data
table = Replace( template,"#URL#", appUrl )
table = Replace( table,"#LINK_ID#", Rec("linkID") )
table = Replace( table,"#LINK_NAME#", Rec("linkName") )
table = Replace( table,"#SPONSOR#", sponsor)
table = Replace( table,"#SUBMIT_DATE#", submitDate)
table = Replace( table,"#RATING#", rating)
 
'print the table
Response.Write table
 
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:

Select allOpen in new window

 

by: coreybryantPosted on 2009-09-10 at 11:15:08ID: 25302829

Thanks - but the script is kind of weird I think.  It is using a few includes already.  

Theoretically, if I was to put this code in its own file and then include it, should that work?  I have just learned that some code that should work, doesn't work properly in this script.

 

by: hieloPosted on 2009-09-10 at 11:20:17ID: 25302867

>>Theoretically, if I was to put this code in its own file and then include it, should that work?
In a word, Yes.

However, what you posted looks like a "fragment" of a larger script. I don't see where you are connecting to the db and retrieving the values. If I was the one trying to put that in a separate file,
FIRST:
I would make sure it is generating the desired output.

AFTER it is working as desired, THEN
I would put it in a separate file. Also, on the code I posted I would put the part that connect to the db and queries the db so that the file is "complete" when viewed by itself.

 

by: coreybryantPosted on 2009-09-10 at 11:48:10ID: 25303096

If it will help - here is the code from that file.  I am still working on it - cleaning it up, but hopefully that will give you a general idea.

I had tried something like:

strRsp = strRsp & ("<table id=""func_functions50"" style=""font-size:12px; border-collapse:collapse; width:100%; border:0px; text-align:right;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)
 strRsp = strRsp & ("<tr><td id=""td-func_functions51"" style=""font-size:12px; text-align:left; background-color:#abcadc; width:50%"">" & vbNewLine )
if Rec("hotLink") = 1 then
  strRsp =  strRsp & "<h3 style=""color:#000000; text-align:left;"">"
 else
 strRsp =  strRsp & "<h3 style=""color:#000000; text-align:left;"">"  
end if
 strRsp = strRsp & ("<a href="""& appUrl &"/links/"& Rec("linkID") & ".asp"">")
strRsp = strRsp & (Rec("linkName") & "</a>" & vbnewline )
if Rec("hotLink") = 1 then
 strRsp =  strRsp & "<td style=""font-size:8px; text-align:left; background-color:#abcadc"">"  
strRsp = strRsp & ("[<span style=""color:#cc0000"">sponsor</span>]</td>")
end if
 if Rec("submitDate") > date - 5 then
  strRsp = strRsp &  "&nbsp;&nbsp;<img border=""0"" src="""& appUrl &"/images/new.gif"">"
end if
 strRsp = strRsp & ("</td><td id=""td-func_functions69"" style=""font-size:12px; background-color:#abcadc; text-align:right; width:20%"">")
strRsp = strRsp & (" &nbsp;" & vbNewLine )
  if Rec("cVotes") = 0 then
   rating = 0
   else
   rating = cint(Rec("Rating") / Rec("cVotes"))
   end if
strRsp = strRsp &  ("<a href=""javascript:openWindowRating('"& appUrl &"/rate.asp?linkID=" & Rec("linkID")& "')"">")
strRsp = strRsp &  ("<img src="""& appUrl & "/images/star_"& rating & ".gif"" border=""0""></a>" & vbnewline)
 strRsp = strRsp & ("</td>" & vbnewline )
strRsp = strRsp & ("</tr></table>" & vbnewline )

Which seemed to work, but IE had a couple of errors and I decided to start over with it

<%
 
	function buildNavi(naviID) 
	dim catIDList(30)
	dim catNameList(30)
	dim catNameDirList(30)
	dim i 
	Dim pID
	Dim cats
	Dim navi
	Dim e
	Dim strLine
	i = 0
 
	Set con = Server.CreateObject ("ADODB.Connection")
	con.Open strCon
	do until naviID = 0
	SQL = "SELECT catID, catName, parentID FROM portal_Categories where catID = "&pID
	Set rs = Server.Createobject("ADODB.Recordset")
	rs.Open "SELECT catID, catName, parentID,dirnavi  FROM portal_Categories WHERE catID = " & naviID, con, 3, 3, 1
	catIDList(i) = rs("catID")
	catNameList(i) = rs("catName")
	catNameDirList(i) = rs("dirnavi")
	naviID = rs("parentID")
	i = i + 1
	loop	
	'rs.Close
	con.Close
	Set rs = nothing
	Set con = nothing
	cats = ubound(catIDList)
	navi = catNameList(0)
	for e = i - 1  to 1 step - 1
	strLine = strLine &  "<a href=""/directory/"& catNameDirList(e) & """>" & catNameList(e) & "</a> / " & vbCrlf
	next 
	buildNavi = strLine & navi
	end function
	
	
	
	Function subCat(cID, page)
	Dim objRec, i, DisplayNum, oCon, Rec, ipage, rating, showpages, z, strRsp
	strRsp = " " 
	if page = 0 or page = "" then
	Set objCon = Server.CreateObject ("ADODB.Connection")
	objCon.open strCon
	objCon.execute("Update portal_Categories set hits = hits + 1 where catID = "& cID &";")
	strSQL ="Select catID, catName, parentID, cCats, cLinks, lastLink, dirnavi from portal_Categories where parentID = "& cID & " order by catName asc"
	set objRec = objCon.execute(strSQL)
	i = 0
	strRsp = strRsp &  "<table id=""tbl_func_dir51"" style=""border:0px; border-collapse:collapse; width:100%"" cellspacing=""0"" cellpadding=""0"">"&VbCrLf	
	Do	While NOT objRec.EOF
	if  i = 0 Then
		strRsp = strRsp &  "<tr>"&VbCrLf
	end if
		strRsp = strRsp &  "<td id=""tbl_func_dir51"" style=""font-size:12px; width:50%;"">"&VbCrLf
		strRsp = strRsp &  "<a href="""& appUrl &"/directory/"& objRec("dirnavi") &""">"&VbCrLf
		strRsp = strRsp &  objRec("catName")&"</a></b>"&VbCrLf
		strRsp = strRsp &  "&nbsp;<font size=""1""> ("& objRec("cCats") & ") ("& objRec("cLinks") & ")</font>"
		if objRec("lastLink") > date - 5 then	
		strRsp = strRsp &  "&nbsp;&nbsp;<img border=""0"" src="""& appUrl &"/images/new.gif"">"
		strRsp = strRsp &  " <br>"&VbCrLf&VbCrLf
		end if		
		strRsp = strRsp &  "</td>"
	if  i = 0 Then
		i = i + 1
		else
		strRsp = strRsp &  "</tr>"&VbCrLf&VbCrLf&VbCrLf
		i = i - 1
	end if
	objRec.MoveNext
	Loop
	strRsp = strRsp & "</table><br/>"
	
	objRec.Close
	objCon.Close
	Set objRec = nothing
	Set objCon = nothing
 
	end if
 
	subCat = strRsp
 
	end function
 
 
 
	function dirListing(catID, curpage)
	
	If curpage = "" Then
		curpage = 1
		else
		curpage = int(curpage)
	End If
	if curpage = 0 then curpage = 1
	catID = int(catID)
	Set oCon = Server.CreateObject ("ADODB.Connection")
	Set Rec = Server.CreateObject ("ADODB.Recordset")
	oCon.Open strCon
	Rec.CursorLocation = adUseClient		
	
	SQL = "SELECT * FROM portal_Links WHERE catID = " & catID
	SQL = SQL & " and active = 0 "
	
	If request.querystring("goto") = "rating" then
	SQL = SQL & " order by rating desc"
	elseIf request.querystring("goto") = "siteName" then
	SQL = SQL & " order by linkName ASC"
	elseIf request.querystring("goto") = "totalHits" then
	SQL = SQL & " order by totalHits desc"
	elseIf request.querystring("goto") = "submitDate" then
	SQL = SQL & " order by submitDate desc"
	else
	SQL = SQL & " order by hotLink desc"
	end if	
	Rec.Open SQL, oCon, adOpenStatic, adLockReadOnly, adCmdText
 
	if Rec.EOF OR Rec.BOF Then
	strRsp = strRsp & "<br><br>"
	strRsp = strRsp & "<p id=""p_func_dir120"" style=""text-align:center; font-weight:bold; font-variant:small-caps;"">No listing found!</p>"
	else	
	Rec.PageSize = 10
    Rec.AbsolutePage = curpage
	next10 = getNext10(curpage)
	prev10 = getPrev10(curpage)	
	
	strRsp = strRsp & "<form name=""dirSort""  method=""GET"" style=""margin:0px"">"
	strRsp = strRsp & "<table id=""tbl_func_dir128"" cellspacing=""0"" cellpadding=""0"" style=""width:100%; background-color:#c3d9e6; border:0px"">"
	strRsp = strRsp & "<tr><td id=""td_func_dir131"" style=""font: 11px verdana, arial, helvetica, sans-serif; color:#000000; width:100%; text-align:right; background-color:#c3d9e6"">"&VbCrLf	
 
	strRsp = strRsp & "There are "& Rec.RecordCount & " results displaying in " & Rec.PageCount & " pages. "
 	strRsp = strRsp & " Sort Order: <input type=""hidden"" name=""catID"" value="& catID &">"
	strRsp = strRsp & "<select name=""goto"" OnChange=formsubmit(document.dirSort);  style=""font:11px verdana, arial, helvetica, sans-serif; background-color:#c3d9e6"">"
	strRsp = strRsp & "<option value=""goto"" selected>Sort By</option>"
	strRsp = strRsp & "<option value=""siteName"" >Site Name</option>"
	strRsp = strRsp & "<option value=""rating"">Rating</option>"
	strRsp = strRsp & "<option value=""totalHits"" >Hits</option>"
	strRsp = strRsp & "<option value=""submitDate"" >Date</option>"
	strRsp = strRsp & "</select>&nbsp;</td></tr></table></form>"
 
	Do Until Rec.AbsolutePage <> curpage OR Rec.Eof			
	strRsp = strRsp & ("<table id=""tbl_func_dir142"" style=""border:0px; border-collapse:collapse; width:100%; text-align:right; background-color:#abcadc;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td style=""padding-left:4px; width:60%; background-color:#abcadc; text-align:left;"">" & vbNewLine )
	if Rec("hotLink") = 1 then 
		strRsp =  strRsp & "<h3 style=""margin:0px; text-align:left;"">"
		else
		strRsp =  strRsp & "<h3 style=""margin:0px; text-align:left;"">"		
	end if
 
	strRsp = strRsp & "<a href=""" & appUrl & "/links/" & Rec("linkID") & ".asp"""
	strRsp = strRsp & " title=""" & Rec("linkName") & """>" & Rec("linkName") & "</a></h3>" & vbnewline
	
    if Rec("hotLink") = 1 then 
	strRsp =  strRsp & "<font style=""font-size:8pt"">"		
	strRsp = strRsp & ("&nbsp;<sup>[<font color=""#cc0000"">sponsor</font>]</sup></font>")
	end if
 
	if Rec("submitDate") > date - 5 then	
		strRsp = strRsp &  "&nbsp;&nbsp;<img border=""0"" src="""& appUrl &"/images/new.gif"">"
	end if
 
	strRsp = strRsp & ("</td><td style=""padding:4px; background-color:#abcadc; width:70px; text-align:right"">")
	strRsp = strRsp & (" &nbsp;" & vbNewLine )
			if Rec("cVotes") = 0 then
				rating = 0 
			else
				rating = cint(Rec("Rating") / Rec("cVotes")) 
			end if
	strRsp = strRsp &  ("<a href=""javascript:openWindowRating('"& appUrl &"/rate.asp?linkID=" & Rec("linkID")& "')"">")
	strRsp = strRsp &  ("<img src="""& appUrl & "/images/star_"& rating & ".gif"" border=""0""></a>" & vbnewline)
 
	strRsp = strRsp & ("</td>" & vbnewline )
	strRsp = strRsp & ("</tr></table>" & vbnewline )
 
	strRsp = strRsp & ("<table id=""tbl_func_dir175"" style=""border:0px; border-collapse:collapse; width:100%; text-align:left;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td id=""td_func_dir176"" style=""padding:2px; width:55%; background-color:#abcadc; text-align:left; font-size:13px;""> &nbsp;" & vbNewLine )
	strRsp = strRsp & ("Hits Today: " & Rec("todayHits") & "&nbsp;|&nbsp;" & vbnewline)
	strRsp = strRsp & ("Overall Hits : " & Rec("totalHits") & "</td>" & vbnewline)
 
	strRsp = strRsp & ("<td id=""td_func_dir180"" style=""padding:2px; width:25%; background-color:#abcadc; text-align:left; font-size:13px;""> &nbsp;" & vbNewLine )
	strRsp = strRsp & ("Updated: " & formatDateTime(Rec("submitDate"), 2) & "</td>" & vbnewline)
 
	ft = dateDiff("d", Rec("submitDate"), Date())
	if ft < 1 then ft = 1
	
	avg = (Rec("totalHits") / ft)
 
	strRsp = strRsp & ("<td id=""td_func_dir188"" style=""padding:2px; width:20%; text-align:right; background-color:#abcadc; font-size:13px;""> &nbsp;Avg. Hit :" & FormatNumber(avg, 1) & vbNewLine )
	strRsp = strRsp & ("</tr></table>" & vbnewline)
 
	strRsp = strRsp & ("<table id=""tbl_func_dir191"" style=""border:0px; border-collapse:collapse; width:100%; border-top:dashed 1px #000000;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td style=""background-color:#abcadc; border-top:dashed 1px #000000; text-align:left; font-size:12px; padding-top:3px; padding-right:5px; padding-left:5px;line-height:20px"">" & vbNewLine )
	strRsp = strRsp & (Rec("linkDesc") & "</td></tr></table>" & vbnewline )
 
	strRsp = strRsp & ("<table id=""tbl_func_dir195"" style=""border:0px; border-collapse:collapse; width:100%"" cellspacing=""0"" cellpadding=""0"" >" & VbCrLf)		
	strRsp = strRsp & ("<tr><td id=""tbl_func_dir196"" style=""font-size:11px; padding:4px; text-align:right; background-color:#abcadc""> " & vbNewLine )
	strRsp = strRsp & ("<a href="""& appUrl & "/redir.asp?catID="& Rec("catID") & "&linkID="& Rec("linkID") & """>Visit Listing</a> | " & vbNewLine )
	strRsp = strRsp & ("<a href="""& appUrl & "/links/" & Rec("linkID")& ".asp#review"">Reviews</a>" & vbNewLine )
	strRsp = strRsp & ( " &nbsp; </td></tr>" & vbnewline )
	strRsp = strRsp & ( "</td></tr>" & vbnewline )
	strRsp = strRsp & ("</table>" & vbnewline )
	strRsp = strRsp & ("<p style=""border-bottom: double #000000; background-color:#c3d9e6; text-align:center; height:5px;""</p> " & vbnewline )
 
	Rec.MoveNext
	Loop
	RSPrevPage = curpage -1
	RSNextPage = curpage + 1
	If Next10 > Rec.PageCount Then
	Next10 = Rec.PageCount
	End If
			strPager = strPager & "<div class=""pages"">"
			If prev10 = 1 AND next10 - 1 < 10 Then
			start = 1
			Else
			start = Next10 - 10
			If right(start, 1) > 0 Then
			start = replace(start, right(start, 1), "0")
			start = start + 10
			End If
			End If
			pageName = "?goto="& request.querystring("goto") & "&page="
			If Rec.PageCount > 1 Then
			If next10 > 10 Then
			strPager = strPager &   "<a class=""nextprev"" href=""" & pageName & Prev10 & """>&lt;&lt;  Previous 10 </a> "
			End If
			If NOT RSPrevPage = 0 then
			strPager = strPager &   "<a href=""" & pageName & RSPrevPage & """>&lt;</a> "
			End If
			For P = start to Next10
			
			If NOT P = curpage then
			strPager = strPager &   "<a href=""" & pageName & P & """>" & P & "</a> "
			Else
			strPager = strPager &   "<span class=""current"">" & P & " </span>"
			End If
			Next
			If NOT RSNextPage > Rec.PageCount Then
			strPager = strPager &   "<a href=""" & pageName & RSNextPage & """>&gt;</a> "
			End If
			
			If NOT Next10 = Rec.PageCount Then
			strPager = strPager &   " <a class=""nextprev"" href=""" & pageName & Next10 & """>Next 10 &gt;&gt;</a>"
			End If
			strPager = strPager & "</div>"
			End If
 
			end if 
	
	Rec.Close
	oCon.Close
	set Rec = nothing
	set oCon = nothing
 
	dirListing = strRsp & strPager
	end function
 
	Function displayInfo(linkID)
 
	Set oCon = Server.CreateObject ("ADODB.Connection")
	oCon.Open strCon
	SQL = "SELECT * FROM portal_Links WHERE linkID = " & linkID
	set Rec = oCon.execute(SQL)
	if NOT Rec.eof then
 
	strRsp = strRsp & ("<table id=""tbl_func_dir265"" style=""border:0px; border-collapse:collapse; width:100%; text-align:right; background-color:#abcadc;"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td id=""td_func_dir266"" style=""padding-left:4px; width:60%; background-color:#abcadc; text-align:left;"">" & vbNewLine )
	if Rec("hotLink") = 1 then 
		strRsp =  strRsp & "<h3 style=""margin:0px; text-align:left;"">"
		else
		strRsp =  strRsp & "<h3 style=""margin:0px; text-align:left;"">"		
	end if
 
	strRsp = strRsp & "<a href=""" & appUrl & "/links/" & Rec("linkID") & ".asp"""
	strRsp = strRsp & " title=""" & Rec("linkName") & """>" & Rec("linkName") & "</a></h3>" & vbnewline
 
	if Rec("hotLink") = 1 then 
	strRsp =  strRsp & "<font style=""font-size:8pt"">"		
	strRsp = strRsp & ("&nbsp;<sup>[<font color=""#cc0000"">sponsor</font>]</sup></font>")
	end if
 
	if Rec("submitDate") > date - 5 then	
		strRsp = strRsp &  "&nbsp;&nbsp;<img border=""0"" src="""& appUrl &"/images/new.gif"">"
	end if
 
	strRsp = strRsp & ("</td><td bgcolor=""#ffffff"" width=""30%"" align=""right"" style=""padding:4px; border-bottom:1px #111111 solid"">")
	strRsp = strRsp & (" <b>&nbsp;" & vbNewLine )
			if Rec("cVotes") = 0 then
				rating = 0 
			else
				rating = cint(Rec("Rating") / Rec("cVotes")) 
			end if
	strRsp = strRsp &  ("<a href=""javascript:openWindowRating('"&  appUrl &"/rate.asp?linkID=" & Rec("linkID")& "')"">")
	strRsp = strRsp &  ("<img src="""&  appUrl & "/images/star_"& rating & ".gif"" border=""0""></a>" & vbnewline)
 
	strRsp = strRsp & ("</td>" & vbnewline )
	strRsp = strRsp & ("</tr></table>" & vbnewline )
 
	strRsp = strRsp & ("<table border=""0"" width=""96%"" cellspacing=""0"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td bgcolor=""#deebff"" width=""55%"" style=""font-size:12px; padding:2px;""> &nbsp;" & vbNewLine )
	strRsp = strRsp & ("Hits Today: " & Rec("todayHits") & "&nbsp;|&nbsp;" & vbnewline)
	strRsp = strRsp & ("Overall Hits : " & Rec("totalHits") & "</td>" & vbnewline)
 
	strRsp = strRsp & ("<td bgcolor=""#deebff"" width=""25%""  style=""font-size:12px; padding:2px;""> &nbsp;" & vbNewLine )
	strRsp = strRsp & ("Updated: " & formatDateTime(Rec("submitDate"), 2) & "</td>" & vbnewline)
 
	ft = dateDiff("d", Rec("submitDate"), Date())
	if ft < 1 then ft = 1
	
	avg = (Rec("totalHits") / ft)
 
	strRsp = strRsp & ("<td bgcolor=""#deebff""  width=""20%"" align=""right"" style=""font-size:12px; padding:2px;""> &nbsp;Avg. Hit :" & FormatNumber(avg, 1) & vbNewLine )
	strRsp = strRsp & ("</tr></table>" & vbnewline)
 
	strRsp = strRsp & ("<table border=""0"" width=""96%"" cellspacing=""1"" cellpadding=""0"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td bgcolor=""#ffffff"" style=""font-size:13px; line-height:19px; padding-bottom:8px;"">" & vbNewLine )
	strRsp = strRsp & (Rec("linkDesc") & "</td></tr></table>" & vbnewline )
 
	strRsp = strRsp & ("<table border=""0"" width=""96%"" cellspacing=""1"" cellpadding=""0"" >" & VbCrLf)	
	strRsp = strRsp & ("<tr><td align=""right"" style=""font-size:11px; padding:4px; border-bottom:1px solid #333333""> " & vbNewLine )
	strRsp = strRsp & ("<a href="""& appUrl & "/redir.asp?catID="& Rec("catID") & "&linkID="& Rec("linkID") & """>Visit Listing</a> " & vbNewLine )
	
	strRsp = strRsp & ( " &nbsp; </td></tr>" & vbnewline )
	strRsp = strRsp & ( "</td></tr>" & vbnewline )
	strRsp = strRsp & ("</table></center><br/><br/>" & vbnewline )
 
 
	strRsp = strRsp & ("<center><b><a href=""#review"">Write Your Own Review </a></b></center>" & vbNewLine )
	strRsp = strRsp & ("<h2 align=""center""><font color=""#cc0000"">" &  request.QueryString("msg") & "</font></h2>" & vbNewLine )
	Rec.close
	set Rec = nothing
	set Rec = oCon.execute("select * from portal_Reviews where linkID = "& linkID &" AND approve =0 order by reviewID desc;")
	if not Rec.eof then
	strRsp = strRsp & ("<table border=""0"" width=""95%"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td width=""100%""  bgcolor=""#fbf5d4"" style=""padding:4px; font-size:11px; color:#bd1111"" align=""left"">" & vbNewLine )	
	strRsp = strRsp & ("<b>Reviews:</b></td></tr></table>" & vbnewline )
 
	do while not Rec.eof
	strRsp = strRsp & ("<center><table border=""0"" width=""95%"" cellspacing=""0"" cellpadding=""0"" bgcolor=""#333333"">" & VbCrLf)	
	strRsp = strRsp & ("<tr><td bgcolor=""#ffffff"" width=""60%"" style=""padding:2px; font-size:13px"">" & vbNewLine )	
	strRsp = strRsp & ("<b>" & Rec("subject") & "</b></td>")
	strRsp = strRsp & ("<td bgcolor=""#ffffff"" width=""40%"" align=""right"" style=""padding:2px""> &nbsp;" & vbNewLine )	
	strRsp = strRsp & ("<img src=""images/star_"& Rec("rating") & ".gif"" border=""0""></td></tr>" & vbnewline)
 
	strRsp = strRsp & ("<tr><td bgcolor=""#fbf5d4"" width=""60%""> &nbsp;" & vbNewLine )
	strRsp = strRsp & ("<i>Written by " & Rec("name") & "</td><td width=""40%"" bgcolor=""#fbf5d4""> <i>" & weekDayName(weekDay(Rec("postDate")), 0) &", " )
	strRsp = strRsp & (MonthName(month(Rec("postDate")), 0) & "  " & Day(Rec("postDate")) & ", " & Year(Rec("postDate")))
 
	strRsp = strRsp & ( "</i></td></tr>" & vbnewline )
 
	strRsp = strRsp & ("<tr><td bgcolor=""#ffffff"" colspan=""2"" style=""padding:2px; border-bottom:1px #111111 solid"">" & vbNewLine )
	strRsp = strRsp & (Rec("review") & "</td></tr>" & vbnewline )
	strRsp = strRsp & ("</table></center><br>"  & vbnewline )
	Rec.MoveNext
	loop
	end if
	end if
	displayInfo = strRsp 
	End function
%>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:

Select allOpen in new window

 

by: hieloPosted on 2009-09-10 at 12:21:35ID: 25303352

post ID: 25302549  is meant to replace 142=>173 or your last post.

 

by: coreybryantPosted on 2009-09-10 at 13:33:15ID: 25303981

Thanks - that helped.  I did two screenshots, the top one showing the code you provided - the titles appearing in the upper left of the browser.  The lower screenshot shows the "correct" layout.

I thought about creating something like the code below (line 153 - 156).  It seems to be working but I was not sure if the code would be OK, especially the widths?  The left cell is a percentage while the right cell is a set width.

Plus I did not know if the code would hold up to more content, etc?

    if Rec("hotLink") = 1 then 
	strRsp =  strRsp & "<font style=""font-size:8pt"">"		
	strRsp = strRsp & ("&nbsp;<sup>[<font color=""#cc0000"">sponsor</font>]</sup></font>")
	end if
 
to
 
    if Rec("hotLink") = 1 then 
    strRsp = strRsp & ("<td style=""background-color:#abcadc; text-align:left; color:#cc0000"">")
	strRsp = strRsp & ("[<span color=""#cc0000"">sponsor</span>]")
	strRsp = strRsp & ("</td>" & vbnewline ) end if
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

Select allOpen in new window

 

by: hieloPosted on 2009-09-11 at 07:20:38ID: 25309765

The screen shots don't help much. Post a sample HTML table of both, the non-working and the working.

 

by: coreybryantPosted on 2009-12-01 at 12:12:14ID: 25946144

Thanks - it seemed I finally figured out most of it.  Sorry for the delay, had another hospitalization stay and surgery.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...