0

Here is my website : http://searchr.us/web-search.phtml

So now,once anyone searches in that page it comes like this :

http://searchr.us/web-search.phtml?search=SEARCHED+TEXT

So now what i want to do is that when a person searches anything for that matter.A page with its title called

http://searchr.us/web-search.phtml?search=SEARCHED+TEXT.html

Or something like that which has the keywords in the title and the content he searched in the body.

Hope you understood the question.

Thanking You, 5416339

4
  • 1
    I think you'll need mod_rewrite (if it's apache and you have chance to use it). Commented Oct 13, 2010 at 17:55
  • Do you mean that you want the results of the search statically stored in an HTML file and that file retrieved any time the same search is made? Commented Oct 13, 2010 at 17:56
  • " flag What have you tried so far ... and where are you having trouble? " Commented Oct 13, 2010 at 17:57
  • @David..yah kind of...But i just want to save the file for the time being Commented Oct 13, 2010 at 17:57

1 Answer 1

4

The question mark is not valid in a URL path; it is used to separate the path from the query string. You will need to detect the presence of a previous search and serve that content up yourself. Putting the search results in a file named after the search terms in a separate directory is a good idea though. See fopen(), fwrite(), fclose(), and readfile().

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks will look at this.Any better suggestion ?
The file I/O operations are probably the easy part. Creating the static file with fully-rendered output will be a little more complex, though not a terribly big deal with a decent template system. Probably just keep a standard search result template with a place to insert the content, open it, do a string place to insert the content, save as a new file.
And do this opening and creating a file each time they search will make my search results a little slow ? Because this has to happen simultaneously right ?
Unless the search is incredibly fast (probably on the order of tens of milliseconds or less), the file output will be only a very tiny fraction of the delay before the page comes up.
I would do it after you've sent everything to the client and flushed it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.