Jump to content

Menu structure

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
Hello folks.. I'd need some advice here.

I'm building a menu system, with topics and items for each topic. No subtopics.
the thing is that each item is only to be shown if the user got the right permissions to see that part of the system.

how would you lay up the structure in php/sql?

one table for topics and one for items?
one table with a field marking it's a topic?

next matter is that the text displayed needs to contain different stuff, sometimes I need to put in a variable's value inside the title of an item, but mostly just plain urls to another page in the websystem.
best method to solve this?

any suggestions on how to layout this?

cheers.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
So it sounds like each menu requires:
1) list of topics
2) list of items with parent topic and permission value
3) list of users with permission levels.
4) list of dynamic content for each topic
5) list of dynamic content for each item
Is this about right?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
hmm. .well, this dynamic content is always the same for each topic/item
i'm thinking of a structure like this:

topics: id, name, evalname
where i store php-code to be eval:ed
and leave either name or evalname empty depending of it's dyminacallity(?)

#4
jessje

jessje

    Learning Programmer

  • Members
  • PipPipPip
  • 64 posts
All above suggestions are good, but what kind of content will be posted? how large will the site grow?
this things also matter for a good structure

#5
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
um.. maybe max 10 topics and max 100 items totally

I actually found the way, I'd store php in database like
return "Items (".$number_of_items." items)";

and evals the info and out plots a nice text string "Items (572 items)" to show up.
I splitted the info to two tables, seemed easier and it follows the most basic database biulding schemes to split any relative info.