how to create dynamic menu from database for cms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egyptcoders
Forum Newbie
Posts: 3
Joined: Wed Aug 04, 2010 5:13 am

how to create dynamic menu from database for cms

Post by egyptcoders »

welcome ,

i want to create dynamic menu that depends on database' tables that i will use it to create cms

i attached an image as an examlpe

can any one help me please
Attachments
cms.png
cms.png (18.01 KiB) Viewed 125 times
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: how to create dynamic menu from database for cms

Post by superdezign »

Well, what kind of database structure are you dealing with? How is the parent-child relationship established? How far have you gotten?
egyptcoders
Forum Newbie
Posts: 3
Joined: Wed Aug 04, 2010 5:13 am

Re: how to create dynamic menu from database for cms

Post by egyptcoders »

i deal with mysql database

this example i not created and also donnot know how it is created , so i asked here

very thanks for you
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: how to create dynamic menu from database for cms

Post by superdezign »

To create a tree structure of similar elements, you'd just set up a parent-child relationship in the main table.

Code: Select all

`navigation_links` table
ID | Parent_ID | Name    | URL
1  | 0         | Parent1 | #
2  | 0         | Parent2 | #
3  | 2         | Child1  | #
4  | 2         | Child2  | #
5  | 4         | Child3  | #
6  | 0         | Parent3 | #

Code: Select all

+ Parent1
- Parent2
  + Child1
  - Child2
    + Child3
+ Parent3
egyptcoders
Forum Newbie
Posts: 3
Joined: Wed Aug 04, 2010 5:13 am

Re: how to create dynamic menu from database for cms

Post by egyptcoders »

thanks , but there is no main table i use

these elements are created automaticaly from database tables , i will need to create a file that organize this structure from the database
so , each table ia an element that i cat set title and href for it , also i can add childs with title and href and so on
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: how to create dynamic menu from database for cms

Post by superdezign »

So, you want us to tell you how to deal with a database table that is already created, yet you have no idea what it looks like and can provide no details as to how it's structured?
Post Reply