[ic] Help? - Search new table from flypage

Kevin Walsh interchange-users@interchange.redhat.com
Wed May 29 12:53:00 2002


> 
> This is sort of a reverse of the scenario I was asking about before -- but not quite. (Always wishing it were that easy!)
> 
> In products.txt I have a field named "ingredients" which contains a comma-delimited list of ingredients for each product. 
> 
> I also have a table named glossary.txt which contains the ingredients with their definitions. Fields: "code", "word", 
> "definition". I have a separate search page for the glossary, as well as a unique results page, "glossary_results.html".
> 
> From the flypage, the user should be able to click on one of the listed ingredients, which would bring up a search result 
> (glossary_results.html) in a new window.
> 
> Easy to do if there were only one ingredient for each product - but how do I have IC trigger a search on each 
> comma-delimited item in the field (eg. [field "ingredients":] Water, Ammonium Lauryl Sulfate, Cocamidopropyl Betaine, 
> Coco Glucoside)? I'd be happy with a select box, but would prefer text links.
> 
> Thanks again in advance. As I become a more experienced IC user, I do hope to someday return the favour!  
> 
You could do it several ways.  Here are a couple of them:

  1) A small block of Perl to split the ingredients into a list of links.
     Each link would point at a glossary entry.

  2) A separate "ingredients" table that links each product each ingredient
     and possibly allows reverse linking where you could search on "water"
     and get a list of products that contain that ingredient. :-)

     The ingredients table would only need two columns (SKU and ingredient)
     to create a many-to-many association table.

     The product page could perform a query on the ingredients table and
     get a list appropriate for that product.  Links could be generated
     to a glossary from there.  The glossary would look like what you
     described as your ingredients.txt, above.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/