|  | Posted by Steve on 04/19/07 22:29 
"Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote in message news:NORVh.1282$H_.157@newssvr21.news.prodigy.net...
 |I wrote some code to read in a file
 |
 | and I'm curious as to is this is a decent way to do it or if there is a
 much
 | more elegant way. Essentially I want to convert a text file that into a ul
 | in html for my nav menu. This way I can easily add and remove links
 without
 | messing with any other code(Except of course where the link points to).
 |
 | Anyways, the code works as far as getting the links into a multi-array
 that
 | I can work with but not sure if its the best way or not.
 
 create table menu
 (
 id      int          not null primary    ,
 parent  int              null default 0  ,
 node    varchar(255) not null            ,
 action  text         not null
 );
 
 now traverse the data to link each node to it's parent. you may only want to
 run this once. in that case, save the menu in a session var. if that var
 isn't set, you know you should build the menu again.
 
 i know i'm talking about databases, however a file is not an adequate
 solution...especially the kind of format you're talking about. an xml file
 *could* be a close second to what i've proposed and you could utilize xslt
 to render the menu. however, it's not as easily maintained as db data.
  Navigation: [Reply to this message] |