You can use automatic navigators in your website to display a navigation based on the available content of the CMS database.
With that you never have to worry about manually changing the HTML of your site only because some content document was added or changed.
In OpenWebCMS? you can create all kind of navigators, no matter if you just want to use plain HTML or some advanced JavaScript? menus.
You can define as many navigators as you like and can include them in your templates using with:
nav=<Name of navigator>
The basic concept is:
A navigator consists of one root navigator document (defining common properties) and one or more 'level format' documents.
A navigator has states: each element can be active or not active, elemens representing areas can be expanded and collapsed (like categorized views in Notes)
In a level format document you define what HTML should be generated for a documents of a sepecific area level (areas can have 'depth' of several levels, using a backslash - for example 'cars\sport\alfa' -> three levels).
In a level format you define HTML for one element of the navigator - that means one content document the navigator shows.
You can define different HTML for active (currently displayed) elements and non-active elements.
You can define different HTML for elements representing content documents and elements representing an area. The Navigator document
Here you give a name for your navigator (used in the nav= statement in templates) and select if you want a view based navigator or a fulltext search navigator.
The view navigator has the expand/collapse functionality and displays all content documents and areas which are not hidden from navigators (you can hide an area or one specific content documents).
The view navigator always uses the internal view ($NavigatorSource?), it is NOT recommended to change that view.
A fulltext search navigator displays content documents found by a fulltext search. The difference to a standard CMS search (and it's result represented by a search result template) is that
The search query is fixed.
You can include several search based navigator on one page.It is useful to create an automatic navigation for content documents of specific criterias, like all news documents older than today, or all content documents created by one specific author.
In a fulltext search navigator you can
Decide if the search result will be cached or not. If caching is allowed, the search operation will be done only once, after that the result is static until the cache is cleared.
Define the maximal count of documents returned by the search operation. A value of 250 or so is recommended to speed up things.
Define after what field the result will be sorted, and if the sort is ascending or descending. You can give text, number or time fields here, the sorting will be done according to the field type. Because the search result is flat, there is no point in defining multiple level format for different leves. So: for fulltext search navigators, create only one level format document for the first level!.
A level format
Place the cursor on a navigator document in the view, then click 'New\level format' to create a new level format for a navigator.
Level: define for which level this level format applies. You can select one or more levels, depending on if you want to have the same HTML for multple levels (then one level format document does the job) or different HTML for different levels (then you need one level format document per level).
Options: decide if you want that only one area is expaned at a time, that means if the user clicks on another area element to expand it, the other element will be collapsed. If you want to have multiple area elements expanded, deselect the option.
Options: select the second option to use the same HTML for content- and area elements.
Format when element is not active: define HTML/DML for elements that are not active. Use variables to include things like the automatic generated URL.
Format when element is active: the same, but for the element which is currently active. HTML/DML for elements
In the 'format for..' fields you can use HTML, DML and variables. There are variables like URL which will be replaces by automatic generated stuff from the system. For example URL will be replaces with the URL for this element, which automatically includes all neccessary navigation parameters.
Or the NAVITEM automically contains the appropiate title or image (depending on the navigation options set in content documents).
But you can also use DML to use formulas and access fields of documents.
Expamples:
One line per element, just containing a link to the element with automically generated URL and title:
<a href="##URL##">##NAVITEM##</a><br>
A custom URL and a custom title, defined with DML:
<a href="#@ "/"+@webdbname+"/(ynDK_contentByKey)/"+key+"?Open" @#>#@ title+" ("+category+")" @#</a><br>