Hi,
Can MS SQL tables be directly connected to a dynamic menu?
Example: Adding a new category in the table and it automatically reflects in the menu.
Yes, you can lookup menu items in a database.
You would basically add a repeat to the navbar Nav element. Here is an example with one static nav item (Home) and then a navbar item that repeats using data that is supplied via a server connect with a database query.
Your database query will obviously be different and will use your own approach for the link, text, etc.
<nav class="navbar navbar-expand-md justify-content-center bg-white navbar-expand">
<div class="collapse navbar-collapse justify-content-center p-3" id="navbar_header_collapse">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="/">Home</a>
</div>
<div class="navbar-nav" dmx-repeat:repeat1="get_current_tenant.data.nav_pages">
<a class="nav-item nav-link " dmx-text="navigation_label.capitalize()" dmx-bind:href="'/'+type" dmx-class:active="browser1.location.pathname.contains(type) ">CMS page(s)</a>
</div>
</div>
</nav>
Already a video on that from the amazing @ben on the Wappler YouTube channel
1 Like
Thank you