Advertisement

02.25.2007 at 08:28AM PST, ID: 22412063
[x]
Attachment Details

Trying to get the layout I want, but not sure how to go about doing it.

Asked by pingeyeg in Active Server Pages (ASP)

I'm not sure how to go about doing this.  I am still fairly new to ASP, but can get around fairly well.  What I am trying to do is when an end user selects a certain category and zip code they get displayed the providers who are in that zip code and category.  My problem is getting the layout I want.  There are premium ads that take up most of the width of the page and then there are basic ads that are half the premium ad.  I want to make it so that all premium and basic ads get displayed for that category/zip code and have the premium ad on per row and the basic ad two per row.  I don't know if this sounds complicated, but in my head it sounds fairly simple I just don't know how to go about doing it.  I have made it where it will either display a premium ad or a basic ad, but not both.  The code for my page is below.  I know it looks aweful, but it is a work in progress.

<tr><td colspan="5">
<%
Dim ConnStr
Dim SQL
Dim viewAd
Dim rs
Dim strZipcode
Dim strCompanyname
Dim strTown
Dim strOwner
Dim strAddress
Dim strPhone
Dim str2ndphone
Dim strMobile
Dim strPager
Dim strFax
Dim strEmail
Dim strWebsite
Dim strInbusiness_since
Dim strLicense
Dim strInsured
Dim strBonded
Dim strHours
Dim str24houremerg
Dim strServicesoffered
Dim strOtherservices
Dim strServicearea
Dim strFreeestimate
Dim strWorkguaranteed
Dim strProvidertagline
Dim strAd_size
Dim strProviderservice
Dim providerID
Dim reviewID

Set viewAd = Server.CreateObject("ADODB.Connection")
ConnStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/mockup/providers.mdb")
viewAd.open(ConnStr)

SQL = "SELECT tblAdspace.strZipcode, tblAdspace.strCompanyname, tblAdspace.strTown, tblAdspace.strOwner, tblAdspace.strAddress, tblAdspace.strPhone, tblAdspace.str2ndphone, tblAdspace.strMobile, tblAdspace.strPager, tblAdspace.strFax, tblAdspace.strEmail, tblAdspace.strWebsite, tblAdspace.strInbusiness_since, tblAdspace.strLicense, tblAdspace.strInsured, tblAdspace.strBonded, tblAdspace.strHours, tblAdspace.str24houremerg, tblAdspace.strServicesoffered, tblAdspace.strOtherservices, tblAdspace.strServicearea, tblAdspace.strFreeestimate, tblAdspace.strWorkguaranteed, tblAdspace.strProvidertagline, tblAdspace.strAd_size, tblAdspace.providerID, tblReviews.reviewID, tblAdspace.strProviderservice FROM tblAdspace, tblReviews where tblAdspace.strZipcode = '" & request.form("strZipcode") & "' OR tblAdspace.strTown = '" & request.form("strTown") & "' "

Set rs = viewAd.execute(SQL)
if not rs.eof then
strCompanyname = rs("strCompanyname")
strOwner = rs("strOwner")
strTown = rs("strTown")
strZipcode = rs("strZipcode")
strAddress = rs("strAddress")
strPhone = rs("strPhone")
str2ndphone = rs("str2ndphone")
strMobile = rs("strMobile")
strPager = rs("strPager")
strFax = rs("strFax")
strEmail = rs("strEmail")
strWebsite = rs("strWebsite")
strInbusiness_since = rs("strInbusiness_since")
strLicense = rs("strLicense")
strBonded = rs("strBonded")
strHours = rs("strHours")
str24houremerg = rs("str24houremerg")
strServicesoffered = rs("strServicesoffered")
strOtherservices = rs("strOtherservices")
strServicearea = rs("strServicearea")
strFreeestimate = rs("strFreeestimate")
strWorkguaranteed = rs("strWorkguaranteed")
strProvidertagline = rs("strProvidertagline")
strAd_size = rs("strAd_size")
strProviderservice = rs("strProviderservice")
providerID = rs("providerID")
reviewID = rs("reviewID")
end if

rs.close
%>
<div style="font: normal 15px verdana; color: #2c5fb2; text-align: center; margin-top: 20px; margin-bottom: 10px">
Search Results For <font color="#cd4141"><%= strZipcode %></font>
</div>
<table width="100%">
<tr><td width="400">
<%
Dim imageName, typeValue

typeValue = request.form("type")

' Check input here if needed
'response.Write(typeValue)


IF typeValue = "electrician" then
      imageName = "/mockup/images/electrician_btn.png"
 
elseif typeValue = "painting" then
      imageName = "/mockup/images/painting_btn.png"

elseif typeValue = "plumbing" then
      imageName = "/mockup/images/plumbing_btn.png"

else
      response.write "Nothing"
end if
%>
<div style="margin-left: 250px">
<img src="<%= imageName %>">
</div>
</td><td style="padding: 10px">
<table cellpadding="0" cellspacing="0" border="0" width="400" align="center" style="font-family:arial; font-size:13px; color: #4E4E4E">
<tr><td>
<img src="/mockup/images/how_top_left.png" />
</td><td style="border-top:#98b2b6; border-top-width:1px; border-top-style:solid;" bgcolor="#edf7fd">&nbsp;
</td><td>
<img src="/mockup/images/how_top_right.png" />
</td></tr>
<tr><td style="border-left:#98b2b6; border-left-width:1px; border-left-style:solid;" bgcolor="#edf7fd">&nbsp;
</td><td bgcolor="#edf7fd" valign="top">
<div style="margin-top:1px">
<b><span style="font-size: 14px">Find the right service provider without the worry in</span></b> <span style="font-size: 18px; color:#2e64eb">1</span><font size="4px">-</font><span style="font-size: 18px; color:#e0a901">2</span><font size="4px">-</font><span style="font-size: 18px; color:#4aaa42">3</span> <b><span style="font-size: 14px">easy steps.</span></b>
</div>
<ol>
<li value="3" class="color3_active" style="margin-top:10px; margin-left:-10px; margin-bottom:-5px; border: 2px solid #4aaa42; padding: 5px; -moz-border-radius: 10px"><span style="font-size:13px; color:#4E4E4E; font-weight: 300"><b>Contact</b></span> <span style="font-size:13px; color:#4E4E4E; font-weight: 300">the <b>Provider</b> of your choice and remember to</span> <img src="/mockup/images/sublogo.png" /> <span style="font-size:13px; color:#4E4E4E; font-weight: 300">about the provider's qualifications (see <a href="#" onmouseover="doTooltip(event, msgTips)" onmouseout="hideTip()"><strong>Smart Tips</strong></a>).  If you're satisfied with the answers received, then <u>confidently</u> hire that service.</span></li>
</ol>
</td><td style="border-right:#98b2b6; border-right-width:1px; border-right-style:solid;" bgcolor="#edf7fd">&nbsp;
</td></tr>
<tr><td>
<img src="/mockup/images/how_bottom_left.png" />
</td><td style="border-bottom:#98b2b6; border-bottom-width:1px; border-bottom-style:solid;" bgcolor="#edf7fd">&nbsp;
</td><td>
<img src="/mockup/images/how_bottom_right.png" />
</td></tr>
</table>
</td></tr></table>
</td></tr>
<tr><td colspan="5">
<div style="padding: 10px">
<%
Dim SQL_select

SQL_select = "SELECT tblAdspace.strZipcode, tblAdspace.strCompanyname, tblAdspace.strTown, tblAdspace.strOwner, tblAdspace.strAddress, tblAdspace.strPhone, tblAdspace.str2ndphone, tblAdspace.strMobile, tblAdspace.strPager, tblAdspace.strFax, tblAdspace.strEmail, tblAdspace.strWebsite, tblAdspace.strInbusiness_since, tblAdspace.strLicense, tblAdspace.strInsured, tblAdspace.strBonded, tblAdspace.strHours, tblAdspace.str24houremerg, tblAdspace.strServicesoffered, tblAdspace.strOtherservices, tblAdspace.strServicearea, tblAdspace.strFreeestimate, tblAdspace.strWorkguaranteed, tblAdspace.strProvidertagline, tblAdspace.strAd_size, tblAdspace.providerID, tblAdspace.strProviderservice, tblReviews.reviewID FROM tblAdspace, tblReviews WHERE tblAdspace.strProviderservice = '" & strProviderservice & "' ORDER BY strProviderservice"

Set rs = viewAd.execute(SQL_select)
if not rs.eof then
strCompanyname = rs("strCompanyname")
strOwner = rs("strOwner")
strTown = rs("strTown")
strZipcode = rs("strZipcode")
strAddress = rs("strAddress")
strPhone = rs("strPhone")
str2ndphone = rs("str2ndphone")
strMobile = rs("strMobile")
strPager = rs("strPager")
strFax = rs("strFax")
strEmail = rs("strEmail")
strWebsite = rs("strWebsite")
strInbusiness_since = rs("strInbusiness_since")
strLicense = rs("strLicense")
strBonded = rs("strBonded")
strHours = rs("strHours")
str24houremerg = rs("str24houremerg")
strServicesoffered = rs("strServicesoffered")
strOtherservices = rs("strOtherservices")
strServicearea = rs("strServicearea")
strFreeestimate = rs("strFreeestimate")
strWorkguaranteed = rs("strWorkguaranteed")
strProvidertagline = rs("strProvidertagline")
strAd_size = rs("strAd_size")
strProviderservice = rs("strProviderservice")
providerID = rs("providerID")
reviewID = rs("reviewID")
end if

if strAd_size = "Premium" then
Dim rows
rows = 0
do while not rs.eof
%>
<table class="premium_border" align="center">
<tr><td colspan="5">
<table width="100%"><tr><td>
<img src="/mockup/images/ad_logo.png">
</td><td id="premium_header">
<%= rs("strCompanyname") %>
<div style="margin-top: 5px; font-size: 13px">
<%= rs("strAddress") %><br />
<%= rs("strTown") %>, NC&nbsp;<%= rs("strZipcode") %><br />
Moore County
</div>
</td><form action="http://maps.google.com/maps" method="get">
<input type="hidden" name="saddr" value="<%= rs("strAddress")%>,<%= rs("strTown")%>,NC">
<input type="hidden" name="hl" value="en">
<td id="google_maps">
Find Business<br />via <input type="submit" value="Google Map" class="btn">
</td></form></tr></table>
</td></tr>
<tr><td>
<table id="premium_ad">
<tr><td>
<table id="premium_ad_td" border="0">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">CONTACT INFO</td></tr>
<tr><td align="right" width="60">OWNER:&nbsp;</td><td width="100" colspan="2"><%=rs("strOwner")%></td></tr>
<tr><td align="right">PHONE1:&nbsp;</td><td><%= rs("strPhone")%></td>
<td align="right">PHONE2:&nbsp;</td><td><%= rs("str2ndphone")%></td></tr>
<tr><td align="right">MOBILE:&nbsp;</td><td><%= rs("strMobile")%></td>
<td align="right">PAGER:&nbsp;</td><td><%= rs("strPager")%></td></tr>
<tr><td align="right">FAX:&nbsp;</td><td><%= rs("strFax")%></td>
<td align="right">E-MAIL:&nbsp;</td><td><%= rs("strEmail")%></td></tr>
<tr><td height="36">&nbsp;</td></tr>
<tr><td align="center" colspan="4"><%= rs("strWebsite")%></td></tr>
</table>
</td></tr>
<tr><td>
<table id="premium_ad_td" border="0">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">OTHER KEY INFO</td></tr>
<tr><td align="right" width="135">LICENSE #:&nbsp;</td><td width="50"><%= rs("strLicense")%></td>
<td align="right">INSURED:&nbsp;</td><td width="75"><%= rs("strInsured")%></td></tr>
<tr><td align="right">BONDED:&nbsp;</td><td><%= rs("strBonded")%></td>
<td align="right">FREE ESTIMATES:&nbsp;</td><td><%= rs("strFreeestimate")%></td></tr>
<tr><td align="right">WORK GUARANTEED:&nbsp;</td><td colspan="2"><%= rs("strWorkguaranteed")%></td></tr>
</table>
</td></tr>
<tr><td>
<table id="premium_ad_td" border="0">
<tr><td align="center" width="250" colspan="2" id="premium_ad_title">SERVICES & HOURS OPEN</td></tr>
<tr><td align="right" width="110">HOURS OPEN:&nbsp;</td><td><%= rs("strHours")%></td></tr>
<tr><td align="right">24 HR. EMERG.:&nbsp;</td><td><%= rs("str24houremerg")%></td></tr>
<tr><td align="right" valign="top">MAIN SERVICES:&nbsp;</td><td><%= rs("strServicesoffered")%></td></tr>
<tr><td align="right" valign="top">SERVICE AREA:&nbsp;</td><td><%= rs("strServicearea")%></td></tr>
<tr><td align="right" valign="top">OTHER SRVS:&nbsp;</td><td><%= rs("strOtherservices")%></td></tr>
</table>
</td></tr>
<tr><td>
<table id="premium_ad_td" border="0" height="75">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">RATING INFO</td></tr>
<tr><td align="center" colspan="4">
<%
if rs("reviewID") = "" and rs("strCompanyname") = "" then
      response.write "SEE ALL REVIEWS"
elseif rs("reviewID") > 0 then
%>
<a href="/mockup/reviews.asp?Company=<%=strCompanyname%>">SEE ALL REVIEWS</a>
<%
end if
%>
</td></tr>
<tr><td align="right">OVERALL RATING:&nbsp;</td>
<td width="80">
<img src="/mockup/images/5_stars.png">
</td>
<td align="right">RATING TREND:&nbsp;</td><td width="50">&nbsp;</td></tr>
<tr><td align="center" height="10px" colspan="2"><span style="font-size: 9px; font-family: verdana">*Covers all customer reviews</span></td>
<td align="center" height="10px" colspan="2"><span style="font-size: 9px; font-family: verdana">*Shows rating direction in last 90 days</span></td></tr>
</table>
</td></tr>
</table>
</td><td>
<img src="/mockup/images/electrician_premium.jpg">
</td></tr>
</table>
<%
rows = rows +1
RS.MoveNext
Loop

end if

if strAd_size = "Basic" then
rows = 0
do while not rs.eof
%>
<div style="padding: 10px">
<table class="basic_border" align="center" border="0">
<tr><td colspan="2">
<table width="100%"><tr><td>
<img src="/mockup/images/ad_logo.png">
</td><td id="basic_header">
<%= rs("strCompanyname")%>
<div style="margin-top: 5px; font-size: 13px">
<%= rs("strAddress") %><br />
<%= rs("strTown") %>, NC&nbsp;<%= rs("strZipcode") %><br />
Moore County
</div>
</td><form action="http://maps.google.com/maps" method="get">
<input type="hidden" name="saddr" value="<%= rs("strAddress") %>,<%= rs("strTown") %>,NC">
<input type="hidden" name="hl" value="en">
<td id="google_maps">
Find Business<br />via <input type="submit" value="Google Map" class="btn">
</td></form></tr></table>
</td></tr>
<tr><td>
<table id="basic_ad">
<tr><td>
<table id="basic_ad_td" border="0">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">CONTACT INFO</td></tr>
<tr><td align="right" width="60">OWNER:&nbsp;</td><td width="100" colspan="2"><%= rs("strOwner") %></td></tr>
<tr><td align="right">PHONE1:&nbsp;</td><td><%= rs("strPhone") %></td>
<td align="right">PHONE2:&nbsp;</td><td><%= rs("str2ndphone") %></td></tr>
<tr><td align="right">MOBILE:&nbsp;</td><td><%= rs("strMobile") %></td>
<td align="right">PAGER:&nbsp;</td><td><%= rs("strPager") %></td></tr>
<tr><td align="right">FAX:&nbsp;</td><td><%= rs("strFax") %></td>
<td align="right">E-MAIL:&nbsp;</td><td><%= rs("strEmail") %></td></tr>
<tr><td align="center" colspan="4"><%= rs("strWebsite") %></td></tr>
</table>
</td></tr>
<tr><td>
<table id="basic_ad_td" border="0">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">OTHER KEY INFO</td></tr>
<tr><td align="right" width="135">LICENSE #:&nbsp; </td><td width="50"><%= rs("strLicense")%></td>
<td align="right">INSURED:&nbsp;</td><td width="75"><%= rs("strInsured") %></td></tr>
<tr><td align="right">BONDED:&nbsp;</td><td><%= rs("strBonded") %></td>
<td align="right">FREE ESTIMATES:&nbsp;</td><td><%= rs("strFreeestimate") %></td></tr>
<tr><td align="right">WORK GUARANTEED:&nbsp;</td><td colspan="2"><%= rs("strWorkguaranteed") %></td></tr>
</table>
</td></tr>
<tr><td>
<table id="basic_ad_td" border="0">
<tr><td align="center" width="250" colspan="2" id="premium_ad_title">SERVICES & HOURS OPEN</td></tr>
<tr><td align="right" width="125">HOURS OPEN:&nbsp;</td><td><%= rs("strHours") %></td></tr>
<tr><td align="right">24 HR. EMERG.:&nbsp;</td><td><%= rs("str24houremerg") %></td></tr>
<tr><td align="right" valign="top">MAIN SERVICES:&nbsp;</td><td><%= rs("strServicesoffered") %></td></tr>
<tr><td align="right" valign="top">SERVICE AREA:&nbsp;</td><td><%= rs("strServicearea") %></td></tr>
<tr><td align="right" valign="top">OTHER SRVS:&nbsp;</td><td><%= rs("strOtherservices") %></td></tr>
</table>
</td></tr>
<tr><td>
<table id="basic_ad_td" border="0" height="75">
<tr><td align="center" width="250" colspan="4" id="premium_ad_title">RATING INFO</td></tr>
<tr><td align="center" colspan="4">
<%
if rs("reviewID") = "" and rs("strCompanyname") = "" then
      response.write "SEE ALL REVIEWS"
elseif rs("reviewID") > 0 then
%>
<a href="/mockup/reviews.asp?Company=<%=strCompanyname%>">SEE ALL REVIEWS</a>
<%
end if
%>
</td></tr>
<tr><td align="right">OVERALL RATING:&nbsp;</td><td width="80"><img src="/mockup/images/5_stars.png"></td>
<td align="right">RATING TREND:&nbsp;</td><td width="50">&nbsp;</td></tr>
<tr><td align="center" height="10px" colspan="2"><span style="font-size: 9px; font-family: verdana">*Covers all customer reviews</span></td>
<td align="center" height="10px" colspan="2"><span style="font-size: 9px; font-family: verdana">*Shows rating direction in last 90 days</span></td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
<%
rows = rows +1
RS.MoveNext
Loop

end if
%>
</td></tr>
</table>
</div>
</td></tr>Start Free Trial
[+][-]02.25.2007 at 11:04AM PST, ID: 18605763

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Sign Up Now!
Solution Provided By: fritz_the_blank
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.25.2007 at 11:10AM PST, ID: 18605778

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2007 at 11:47AM PST, ID: 18605884

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.27.2007 at 05:10PM PST, ID: 18622057

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.27.2007 at 05:17PM PST, ID: 18622088

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.28.2007 at 07:12AM PST, ID: 18625563

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32