Hi, all --

So I have this help script which will have a whopping bunch of help
entries in it and I'm thinking about categorizing.

Of course, I could just leave everything in one big array and then use
the targets, which will become the array keys, directly.  But I think I'd
like to categorize the tips, which means that I'll have to find a given
help topic (eg "addpix" or "resize") not just in a big array but in one
of many category arrays ("General", "Upload", "Manipulate", and so on).
So I need to know 'x' for

  $help_x[$tip]

so that I can display the contents.

I'm gonig to have to traverse all arrays anyway, because I'm going to
have a list of categories and tips down the left side, so building some
sort of index probably wouldn't cost me too much.  I could do something
like

  // setup
  $req = some_parse_query_string_function() ;
  // index column down left side
  foreach ( array_values($categories) as $v )
  {
    print "<span class='cat'>$v</span><br>\n" ;
    foreach ( array_keys($categories[$v]) as $k )
    {
      $index[$k] = $v ;                 # index each tip's category
      print "<a href='$URL?req=$req' class='tip'>$req</a>" ;
    }
  }
  // tip window on right side
  print "<span class='show'>$categories["$index[$req]"][$req]</span>" ;

but I wonder if such an index is a good way to go and how that mess on
the last line will really work out.

I had hoped to do this conversion from a big file much like

  <html>
  <head>
  </head>
  <body>
  <pre>
  <a name='tipname'>
  Text text text
  <a name='another'>
  More text
  ...
  </pre>
  </body>
  </html>

to something with a nicer presentation in a quick swoop, which means not
going to a database yet (where I could, with a bit of planning, have a
table of categories and tips and easily make my links with the power of
the DB), but if this method will be just as painful as jumping to that
then perhaps I should bite the bullet and do it now.  Or maybe this ver
doesn't get categories, just like the current sprawl of HTML doesn't have
that blessing, either :-)

Recommendations?  Ideas?  Caveats?


TIA & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to