| Author |
Topic Search Topic Options
|
wolfie
Groupie
Joined: 18 November 2002
Location: United Kingdom
Status: Offline
Points: 64
|
Post Options
Thanks(0)
Quote Reply
Topic: Searching a Flat File Posted: 24 February 2005 at 12:56pm |
My website, WolfWeb.zero is made using a flat file system. My flat file system works on one page of ASP that is split up using
if Request.querystring("page") = "thisPage" then
Now, I want to be able to search the file for something and then make the search return the page of the right querystring.
So if the search is "blogs" then it finds a piece of text in a page under the request (ie ("page") = "blogs") and so it returns the URL http://www.wolfweb.co.uk/?page=blogs.
My site also runs of a Access backend, so that the blogs, say, are placed dynamically in the page (just like the Journal on WWG) so the search field needs to be able to do that.
So, using that rough guide as to what I want, can anybody help?
Cheers!
|
Wolfie--[ WolfWeb.co.uk ]
PHP, .net--[ beginner ] ASP, VB, C, SQL--[ intermediate ] X/D/HTML, CSS, WML, XML--[
|
 |
bootcom
Senior Member
Joined: 26 February 2005
Location: United Kingdom
Status: Offline
Points: 259
|
Post Options
Thanks(0)
Quote Reply
Posted: 27 February 2005 at 10:21pm |
Let me see if I get you ... you want to enter some thing and have it come up with that as a querystring ? So if a user enters blogs you want it to go to ?page=blogs ????
If that is the case, its relatively simple to do.
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 28 February 2005 at 12:53am |
Assuming you've loaded your file into a string called strFileText something like this should work...
strStartPos = strStartFoundWordPos - strLength
strLength = strLength + Len(request.querystring("page"))
StrURL = mid(strFileText,strStartPos,strLength)
I'm not sure about what else you're trying to do with the access db - e.g. where/when are you going after it after you pull a url. Not Tested
Edited by dpyers - 28 February 2005 at 12:58am
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
wolfie
Groupie
Joined: 18 November 2002
Location: United Kingdom
Status: Offline
Points: 64
|
Post Options
Thanks(0)
Quote Reply
Posted: 28 February 2005 at 11:43am |
Well, here's the code to load up a page.
<% if Request.querystring("page") = "thisPage" then %>
This is page 1
<% end if
if Request.querystring("page") = "newPage" then %>
This is a new page
<% end if %>
|
Wolfie--[ WolfWeb.co.uk ]
PHP, .net--[ beginner ] ASP, VB, C, SQL--[ intermediate ] X/D/HTML, CSS, WML, XML--[
|
 |
dj air
Senior Member
Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
|
Post Options
Thanks(0)
Quote Reply
Posted: 28 February 2005 at 11:44am |
|
or you can uise the elseif command and use
<% if Request.querystring("page") = "thisPage" then %>
This is page 1 <%
elseif Request.querystring("page") = "newPage" then %>
This is a new page
<% end if %>
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 28 February 2005 at 12:23pm |
<% if Request.querystring("page") <> "ThisPage" then
strStartPos = strStartFoundWordPos - strLength
strLength = strLength + Len(request.querystring("page"))
StrURL = mid(strFileText,strStartPos,strLength)
Server.Transfer(StrURL)
end if %>
With the above code, if it's not asking for ThisPage, it will pull the proper page info, buld the url, and transfer control to that url.
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
wolfie
Groupie
Joined: 18 November 2002
Location: United Kingdom
Status: Offline
Points: 64
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 March 2005 at 12:37pm |
|
I'm not picking up how to do this... I rather not put my page in the
form of a string, but outside the ASP area. So simple XHTML.
But will this actully search my site (or flat file) for a certain word
and then pull up the page? Not just if the word is in the querystring.
(I'm still fairly new to ASP so forgive me!)
|
Wolfie--[ WolfWeb.co.uk ]
PHP, .net--[ beginner ] ASP, VB, C, SQL--[ intermediate ] X/D/HTML, CSS, WML, XML--[
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 March 2005 at 4:37pm |
No, I thought you had the words and associated links all in one file so reading it into a string wasn't a big deal.
If you want to search the contents of all files on your site you'll need a more expansive script. Check aspin.com or one of the other script sites for a search script.
Frontpage also has a search component.
|
Lead me not into temptation... I know the short cut, follow me.
|
 |