PDA

View Full Version : Embedding Search Results Using a Preset Search String


tutor2u
07-19-2007, 01:07 PM
I wonder whether the following is possible with Zoom 5.

I know the (say) top 500 search terms that website visitors are looking for when they visit our site (we have over 40,000 pages).

I would like them to be able to visit a specific page that has the search results for a popular search term already displayed.

E.g. - a student is looking for an introduction to the marketing mix
The user comes to a page on our site titled "Marketing Mix - Introduction".
In the body of the page, there is a listing of relevant resources on the website (there are about 30-40 notes, quizzes, glossaries etc) which is generated by Zoom.
i.e. there is no need for them to reenter the phrase "marketing mix - introduction" (they will already have done this in google, yahoo etc).

Is this possible?

Jim

wrensoft
07-19-2007, 10:57 PM
So if I understand you correctly you are wanting a script that will take the existing title of your HTML page and then call Zoom to do a search using the text in the title, then insert the search results into the same page?

Using SSI, in a SHTML file, you can do something like this,
<!--#include virtual="search.php?${QUERY_STRING}" -->

Obviously you would need to set QUERY_STRING to the page title. You would also need to supress the generation of the search form from the Zoom configuration window, in order to just get the search results.

Another approach would be to use some scripting to call the search.cgi and get it to return results in XML format. Then you can parse the display the results using a script that you write.

tutor2u
07-20-2007, 07:12 AM
Thanks for the guidance. How do I suppress the generation of the search form in search.php?

Jim

[quote=wrensoft;7281]

Obviously you would need to set QUERY_STRING to the page title. You would also need to supress the generation of the search form from the Zoom configuration window, in order to just get the search results.
quote]

Ray
07-20-2007, 07:23 AM
On the "Search Page" tab of the Configuration window, change the "Search form" dropdown from "Advanced" to "Do not generate". You will need to re-index for this to take effect.

tutor2u
07-20-2007, 07:51 AM
Thanks - very straightforward! Reindexing now underway

Jim

tutor2u
07-20-2007, 09:28 AM
Ok - had a go, but not quite right yet.

http://www.tutor2u.net/resources/boston-matrix.shtml

The SSI code is:

<!--#include virtual="/search/search.php?${boston matrix}" -->

Must be missing something here?

Jim

tutor2u
07-21-2007, 10:06 AM
any thoughts on what i'm doing wrong?

Jim

wrensoft
07-23-2007, 11:58 AM
I just got a 404 page not found error when I tried to look at the URL you posted above. The page does not exist.

In my example, ${QUERY_STRING}" was a variable.

If you hard code it, it would be,

<!--#include virtual="/search/search.php?zoom_query=boston+matrix" -->

Of course this assumes your web server supports and is set up to allow SSI. (most Unix & Linux servers are). Plus it further assumes you are using the PHP option in Zoom and that search.php is found in a folder called /search/.

If your server doesn't support SSI, or these assumptions are not valid for your site, then you will need to do something similar in PHP, ASP or other scripting language which is available on your server.