I Need help to create database driven nav menu

Yup I just tested this out, and obviously it is pretty dependant on your database and your needs however.

Database Structure

id url name status depth
1 /index.php Home 1 1
2 /about.php About Us 1 1
3 /contact.php Contact Us 1 1
4 /products.php Our Products 1 1
So I have used a really simple database, most is self explanatory, the status is 0 for disabled or 1 for enabled, because I may not want to always have a navigation items that shows in the navigation, like a privacy policy, i may only want that to show as a link in some text or in the footer, so i can set the status to 0.
The depth is 1 for all navigation i want to show all the time, if I had a dropdown I may make it depth 2 lets say, for navigation i want to show inside a dropdown menu.

In its simplest form you need a database query

  1. Server connect, make a database query to call in all your navigation data, save
  2. Make a new page
  3. Make sure all the frameworks are added like jquery, app connect, bootstrap
  4. Save your page
  5. Click App in your App Structure, give it some random App ID
  6. Right click App, choose Data, Server Connect
  7. Choose your action back to the database query you made in Step 1
  8. Right click App, choose Blocks, choose Navigation, I chose Brand Menu
  9. Arrow out everything, till you find 3 x Nav Item elements, delete 2 of them, leaving 1
  10. Click Navbar Nav, in the properties, click Make Repeat Children
  11. Choose your expression of the Server Connect data query from the App Structure
  12. Click Nav Item element again, in properties uncheck Active, click the Dynamic Data Picker next to the Text Property, and choose your "name" binding.
    Remove the "#" symbol from the Link Property.
    Scroll down to Dynamic Attributes and click the + and add Link, click the Dynamic Data Picker and choose your "url" binding.

Save and test, mine worked great.
Obviously for dropdowns etc. you are going to need to use nested repeats, more data on those can be found here

4 Likes