Jump to content

(php) search phrase to populate side columns with terms..


grk101

Recommended Posts

So i am trying to help my buddy with his website here. but we are a both a bit lost.

 

i'll give you guys exaples cause i think its probalby the only way i even understand it.

 

Lets say you search his website for the term " pizza "

 

you'll have the term $search = 'pizza';

 

what he wants to do is on the side column, have a list of words that tie with the word pizza..

 

So example: Mushrooms, pine apple, bacon, cheese:

 

is this possible?

 

I thought maybe doing a switch case php would work.. i might be work..

 

<?php
$selected_term = $_GET['pizza'] ;
switch ($selected_term) {
case 1:
    include("toppings1.php");
    break;
case 2:
    include("blah.php");
    break;

}

?>

 

I am probably wrong now that i look at it, but if anyone could help?

 

thanks

coming up with a system to link similar stuff like that is not really going to be the hard part.  You can do something as simple as have a table of words with ids and a list of ids of all other words you want to be associated with it. 

 

The hard part is mapping out what words relate to each other.  There is no "set in stone" list.  Your example links those other words to pizza because they happen to be toppings on a pizza.  Well that's an arbitrary link.  You will not, for instance, see mushroom show up on a list of words for pizza in a standard thesaurus (or visa versa).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.