www.webdeveloper.com
Results 1 to 7 of 7

Thread: How to search words in text files

  1. #1
    Join Date
    Jul 2005
    Posts
    2

    Red face How to search words in text files

    How to search words in text files even they are not in the same directory?
    -------------------------------------
    If I have a website. It has some of directories in it. How to build a search page to open every each *.htm, *.html file and search key words in it? And then response the results in HTML.

  2. #2
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    You are talking very labor intensive process, plus JavaScript has no clue what files are in the directory. Best thing is to use a server side language to do it. If that is not possible, create a js file that has arrays (indexed data) of information that you update for every page. Search this instead of multiple pages.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

  3. #3
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Javascript can't read files so you will need a server side solution.
    Stephen

  4. #4
    Join Date
    Jul 2005
    Posts
    2
    Eric and Stephen, Thanks for your comments. It seems that the only solution will be in server side solution.

    *solute*

  5. #5
    Join Date
    Sep 2013
    Posts
    1
    What about using Text Finding? I think it is a good and easy to search word in text files.

  6. #6
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    becuase its a local application. he wants the results to run as the result of a user action on a web page.

  7. #7
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,036
    Set up a database, far more simpler and you can have a couple of PHP scripts, one to handle the AJAX calls to it for keywords etc, another that parses a HTML page for content.

    I am assuming that your content is going to be static. If it isn't then look in to a CMS system that has the search features you need already built in.
    Last edited by \\.\; 09-14-2013 at 11:47 AM. Reason: Felt like trying to edit a post after posting...
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles