dominoGuru.com

Your Development & Design Resource

Dynamic Web Menus via View Content

The other day Mike Golding turned me on to Dynamic Drive's Switcher Menu. I personally use Brainjar's Revenge of the Menu Bar and thought that I could use the configuration documents and display views to build out both of these "on the fly" while allowing me to dynamically control exactly what is contained within each "menu bar" or how many "menu bars" my application has.

The following is a brief breakdown on the example database that I built!

Using the below form, we entered some information into the form called contentbuilder which we would use as the basis for each "menubar". A simple category field, a multi-value text field to store the links and we had all that would be needed to populate the "menubar".

Content Builder

Now that we have the actual menu information, it was time to build the menus themselves.


For my index.html example (seen in the database), I simply created a view called "Menus.html" and created a category with this formula:

"<div class=\"menutitleindex\" onclick=\"SwitchMenu('" + Category + "')\"><img src=\"foldopen.gif\" align=absmiddle>  " + Category + "</div>" + @NewLine + "<span class=\"submenuindex\" id=\"" + Category + "\">" + @NewLine + @NewLine + @Implode("<a href=\"" + Links + "\" target=\"_blank\">" + Links + "</a><br />") + @NewLine + @NewLine + "</span>" + @NewLine + "</div>"

Now, I just added a $$ViewBody field to the $$NavigatorTemplate for index.html form, set it to "Computed for Display" for "Menus.html" and I had my quick navigator!

Example Menues

Since the document contains the Category and Links information, all I need to do is use that information in the view column to create the menu that I want!

Dynamic Drive's Menu
Brainjar's Menu

Download the example database via the link below to see just what I'm talking about!

Download Now


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.