Forums
This topic is locked
Please help with ASP wild mask in file name
Posted 31 May 2006 03:18:22
1
has voted
31 May 2006 03:18:22 Dan Deniskin posted:
<b> Dreamviewer 8 / MS Access DB / </b>I have following data base shema :
Filed1 Name: ID number
Field2 Name: Description
and folder [imagesmls] with images with file names : IDnumber_xxx_xx.jpg
those records not in database. I am using dreamviewer connection module with recordset and etc.
created table to show database records and images but there is question:
how can i use some kind of wild care which allows pull out images from image folder based on id number
<img src="imagesmls/<%=(Recordset1.Fields.Item("Field1".Value)%>_101.jpg" width="115">
sample: http://luckymountainhome.com/rmls.asp
------------------------------------------------------------------------------
code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/mlsdatasource.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_mlsdatasource_STRING
Recordset1.Source = "SELECT * FROM residential"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
If (Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = Recordset1
MM_rsCount = Recordset1_total
MM_size = Recordset1_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "" Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index"
If (MM_param = "" Then
MM_param = Request.QueryString("offset"
End If
If (MM_param <> "" Then
MM_offset = Int(MM_param)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
Recordset1_first = MM_offset + 1
Recordset1_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (Recordset1_first > MM_rsCount) Then
Recordset1_first = MM_rsCount
End If
If (Recordset1_last > MM_rsCount) Then
Recordset1_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "" Then
MM_paramList = Split(MM_keepMove, "&"
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=" - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "" Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "" Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
MM_urlStr = Request.ServerVariables("URL" & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<html>
<head>
<title>Real Estate - Breckenridge, Frisco, Vail, Keystone - Rocky Mountain Region</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(images/back.jpg);
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
}
a:link {
color: yellow;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFF00;
}
a:hover {
text-decoration: underline;
color: #CCCCCC;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
.style1 {
font-size: 10px;
color: #66FF66;
}
.style5 {
color: #FFFF00;
font-weight: bold;
}
.style6 {color: #FFFFFF}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#"!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?")>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" onLoad="MM_preloadImages('images/about_us_on.gif','images/b_inside_on.gif','images/nb_on.gif','images/real_tools_on.gif','images/travel_on.gif','images/site_map_on.gif','images/contact_us_on.gif','images/policy_on.gif','images/condo_th_on.gif','images/single_family_on.gif','images/vacant-land_on.gif','images/mls_search_on.gif')">
<!-- ImageReady Slices (rules_lmh.psd) -->
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="195"><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="195" height="120">
<param name="movie" value="images/logo.swf">
<param name="quality" value="high">
<embed src="images/logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="195" height="120"></embed>
</object></td>
<td width="471"><img src="images/map_phone.gif" width="471" height="120"></td>
<td width="12"><img src="images/dots_top.gif" width="12" height="120"></td>
<td valign="top" bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="sitemap.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image34','','images/site_map_on.gif',1)"><img src="images/site_map.gif" name="Image34" width="122" height="27" border="0"></a></td>
</tr>
<tr>
<td><a href="contactus.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image35','','images/contact_us_on.gif',1)"><img src="images/contact_us.gif" name="Image35" width="122" height="26" border="0"></a></td>
</tr>
<tr>
<td bgcolor="#000000"><a href="policy.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image36','','images/policy_on.gif',1)"><img src="images/policy.gif" name="Image36" width="122" height="25" border="0"></a></td>
</tr>
<tr>
<td><img src="images/home_roof.gif" width="122" height="42"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5" background="images/line_menu_after.gif"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="186" height="185" valign="middle"><!--#include file="quickmenu.asp"--></td>
<td> <img src="images/real_tools.jpg" alt="" width="370" height="185"></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="http://www.luckymountainhome.com/mls.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image37','','images/condo_th_on.gif',1)"><img src="images/condo_th.gif" name="Image37" width="110" height="46" border="0"></a></td>
</tr>
<tr>
<td><a href="http://www.luckymountainhome.com/mls.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image38','','images/single_family_on.gif',1)"><img src="images/single_family.gif" name="Image38" width="110" height="45" border="0"></a></td>
</tr>
<tr>
<td><a href="http://www.luckymountainhome.com/mls.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image28','','images/vacant-land_on.gif',1)"><img src="images/vacant-land.gif" name="Image28" width="110" height="45" border="0"></a></td>
</tr>
<tr>
<td><a href="http://www.luckymountainhome.com/mls.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image39','','images/mls_search_on.gif',1)"><img src="images/mls_search.gif" name="Image39" width="110" height="49" border="0"></a></td>
</tr>
</table></td>
<td bgcolor="#000000"><a href="lodging.asp"><img src="images/rest_of_home.gif" width="134" height="185" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5" background="images/line.gif"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="aboutus.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image30','','images/about_us_on.gif',1)"><img src="images/about_us.gif" alt="Remax about us" name="Image30" width="101" height="43" border="0"></a></td>
<td><a href="breckenridge_inside.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image29','','images/b_inside_on.gif',1)"><img src="images/b_inside.gif" alt="Breckenridge Inside" name="Image29" width="162" height="43" border="0"></a></td>
<td><a href="neighborhood.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image31','','images/nb_on.gif',1)"><img src="images/nb.gif" name="Image31" width="157" height="43" border="0"></a></td>
<td><a href="real_estate_tools.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image32','','images/real_tools_on.gif',1)"><img src="images/real_tools_on.gif" name="Image32" width="162" height="43" border="0"></a></td>
<td><a href="travel_and_transportation.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image33','','images/travel_on.gif',1)"><img src="images/travel.gif" name="Image33" width="219" height="43" border="0"></a></td>
</tr>
<tr>
<td colspan="5" height="20"> <div align="center">| <a href="realestateadvice.asp">Real Estate Advice </a> | <a href="statistics.asp">Statistics</a> | <a href="calculators.asp">Calculators</a> | <a href="inforequestform.asp">Info Request Form </a> | <a href="real_estate_glossary.asp">Real Estate Glossary </a> | </div></td>
</tr>
</table></td>
</tr>
<tr>
<td background="images/line.gif" height="5"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" background="images/main.gif"><table width="100%" border="0" cellspacing="8" cellpadding="8">
<tr>
<td valign="top" class="style5"><h3>MLS RESIDENTIAL / DRAFT </h3>
<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="#000000">
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td width="21%" bgcolor="#333333"><img src="imagesmls/<%=(Recordset1.Fields.Item("Field1".Value)%>_101.jpg" width="115"></td>
<td width="21%" bgcolor="#333333">MLS # <%=(Recordset1.Fields.Item("Field1".Value)%></td>
<td width="56%" bgcolor="#333333" class="style6"><%=(Recordset1.Fields.Item("Field155".Value)%></td>
<td width="23%" bgcolor="#333333" class="style6">Price: $<%=(Recordset1.Fields.Item("Field137".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<p align="center"><A HREF="<%=MM_movePrev%>"><< Previuos</A> | | <A HREF="<%=MM_moveNext%>">Next >></A></p></td>
</tr>
</table> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="73" align="center" valign="middle" background="images/bottom_menu.gif"><table width="100%" border="0" cellspacing="5" cellpadding="5">
<tr>
<td><div align="center"><a href="aboutus.asp">ABOUT US</a></div></td>
<td><a href="breckenridge_inside.asp">BRECKENRIDGE INSIDE</a></td>
<td><div align="center"><a href="neighborhood.asp">NEIGHBORHOOD</a></div></td>
<td><div align="center"><a href="real_estate_tools.asp">REAL ESTATE TOOLS</a></div></td>
<td> <div align="center"><a href="travel_and_transportation.asp">TRAVEL AND TRANSPORTATION</a> </div></td>
</tr>
</table> </td>
</tr>
<tr>
<td bgcolor="#000000"><table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="31%"><div align="center">All Rights reserved LMH 2005© </div></td>
<td width="37%" bgcolor="#000000"><div align="center" class="style1">лучше гор могут быть только горы</div></td>
<td width="32%"><div align="center">We build Virtual Homes - <a href="http://www.eboxlab.com" target="_blank">Eboxlab.com</a> </div></td>
</tr>
</table></td>
</tr>
</table>
<!-- End ImageReady Slices -->
<div align="center"></div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
-----------------------------------------