Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Recurring to a secondary search script

Quote Reply
Recurring to a secondary search script
Hi,

I want to do this:
If a term is not found in my LinksSQL database, automatically link the searched term to another search script.... is this possible?
Quote Reply
Re: Recurring to a secondary search script In reply to
The easiest thing to do is on the Search Results page, and Search Errors page, make a link to the new search script, and pass it the <%query%> parameter.

Many of us do this to link searches to the search engines or Amazon, etc.

As for automatically running a separate search script -- if that script is on your server, it's possible with a SYSTEM call, but if the script is not on your server, it's a lot easier to use the method above, than to try to trigger the script from another script.

You might be able to use the redirect command to send the browser to the new URL, but you'll be sending them off your site unless you use frames.....

print $in->redirect ($goto)

(Check the jump.cgi for some ideas)


Quote Reply
Re: Recurring to a secondary search script In reply to
The script IS on the same server.

Do I have to call it from search.cgi ? or how?

I'd like the results to appear as if they were integrated to LinksSQL

[This message has been edited by ekaram (edited March 25, 2000).]
Quote Reply
Re: Recurring to a secondary search script In reply to
If it's your script, the easiest thing would be to actually incorporate it into the search.cgi -- such that if the links search failed, you ran the "default_search" sub routine, which would be this script.

The reason for that is you would not have to worry about browser connects, etc. and the user would get the output in their screen.

You could wrap the output in a Links page the way the "error" subroutine does. (It just puts a variable into the middle of the content area of a template.)

You'd need to make sure you initialized and declared all the variables in the other search script, so that it was mod_perl compatible, but that shouldn't be too hard. The error log will tell you where the errors are, just start with the first one, fix it, and keep running the program til it runs error free <G>

I don't know if there are problems with running a script from inside another script and returning the information from that script to the browser --- I know you can return it to the calling program, which then sends it to the browser --- which is why I suggest the simple ways above.