Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2003, 04:09 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp search page help.

Hi,

There is this link <a href="www.jockme.com/pastoral_correctional.htm">Correctional Ministries</a> on my html page.

I am using this search that displays the results of my find which is just searching text files and my program is displaying the link: pastoral_correctional.htm as the search results.

IE.

Search Results:

- pastoral_correctional.htm




I want to display the value: Correctional Ministries instead, and it will link to the pastoral_conrrectional.htm page. HOw can i do that?

Here is the code for my search when i click on the word search it jumps to this asp page displaying my results.

<HTML><BODY>
<B>Search Results for <%=Request("SearchText")%></B><BR>

<%
Const fsoForReading = 1

Dim strSearchText
strSearchText = Request("SearchText")

'Now, we want to search all of the files
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")


Dim objFolder
Set objFolder = objFSO.GetFolder(Server.MapPath("/"))

Dim objFile, objTextStream, strFileContents, bolFileFound
bolFileFound = False

For Each objFile in objFolder.Files
  If Response.IsClientConnected then
    Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)

    strFileContents = objTextStream.ReadAll

    If InStr(1,strFileContents,strSearchText,1) then
       Response.Write "<LI><A HREF=""/" & objFile.Name & _
                      """>" & objFile.Name & "</A><BR>"

       bolFileFound = True
    End If

    objTextStream.Close
  End If
Next

if Not bolFileFound then Response.Write "No matches found..."

Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
</BODY></HTML>

thanks


 
Old September 8th, 2003, 04:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As far as I understand your problem, this should be expected since you write...

Response.Write "<LI><A HREF=""/" & objFile.Name & """>" & objFile.Name & "</A><BR>"

You output the file in which the search result was found.

Is it that you don't want to output the file name but a better label corresponding to that file...!? And in this case where would you get/find such maching label (filename <-> label)?!

Jacob.
 
Old September 8th, 2003, 04:53 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yea, i dont want to output the file name. I want to output the text. I want to find a way to output the text and i want to pull it from the html <a href> tag in some way.. but i dont know how to go around doing this

 
Old September 8th, 2003, 05:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, sorry but I don't quite get the setup... Where is the text...

<a href="www.jockme.com/pastoral_correctional.htm">Correctional Ministries</a>

I can see that you are searching the files in some folder for some user input, right? And you have got another file where you map the label 'Correctional Ministries' to 'pastoral_correctional.htm', or is it that the SearchText is in fact 'pastoral_correctional.htm'?

Jacob.
 
Old September 9th, 2003, 10:05 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The text is from an html page:
<html>
<a href="www.jockme.com/pastoral_correctional.htm">Correctional Ministries</a>
</html>

The search page is searching through the folders for the search text and then it will display the search results: pastoral_correctional.htm.

I want to find a way to have it display the value Correctional Ministries. Is there a way?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Search Tool in ASP Page.Urgent Help Need anand_asv Classic ASP Basics 2 February 7th, 2006 05:03 AM
Urgent Help. How to have search screen in ASP Page anand_asv Classic ASP Components 0 February 2nd, 2006 07:49 AM
Google Adsense for Search script in asp.net page claudew BOOK: ASP.NET Website Programming Problem-Design-Solution 6 September 20th, 2004 08:59 PM
Search Page Help mvollmer Classic ASP Databases 16 November 19th, 2003 02:53 PM
search page boo Classic ASP Databases 1 July 24th, 2003 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.