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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.