Content in the Javascript library assumes a sound understanding of ECMAScript, CSS, XHTML and DOM.
Creating a menu is easy - make a copy of ecms_config.js and start editing. Any text editor will do. The file does not have to be called ecms_config.js, and it does not necessarily need to be in the same directory as the system files.
The top of this file is for customisation settings,
scroll down until you see BUILD THE MENU
.
A sample menu is provided which can be modified.
Use this function to add an item (folder, or child item) to the menu:
ECMS_add_item(level, name, url, target, expanded);
where:
true
to expand this folder when the menu loads
Items must be added in the order they appear when the menu is fully expanded.
Always finish with ECMS_end_menu();
which generates the HTML code to display the menu on the page.
To add an item to a folder, set the level
parameter to be one greater
than the level of the folder. Folders are automatically created from previous items
when new items are added to them.
In the example menu, there are two main sections: Home and Help (both are level 0). The Home folder has a number of items: About, Information, Contact, Logout. These items all have a level of 1 (one) and come before the Help folder is listed. Feedback is at level 2, so it belongs in the folder Contact (the closest folder before it with a level of 1).
ECMS_add_item(0, 'Home', '', '', true, ''); // initially expanded top level
ECMS_add_item(1, 'About', '/about/', ''); // use blank '' for empty values, or omit them
ECMS_add_item(1, 'Information', '/info/', '', 'left'); // target the frame "left"
ECMS_add_item(1, 'Contact', '/contact/');
ECMS_add_item(2, 'Feedback', '/contact/feedback/', '', '', '', 'Feedback is welcome');
ECMS_add_item(1, 'Logout', '/logout/');
ECMS_add_item(0, 'Help', '/help/'); // 0 denotes a new top level menu item
ECMS_add_item(1, 'Search', '/search/');
ECMS_add_item(1, 'Sitemap', '/sitemap/');
ECMS_end_menu();