Board Logo

Substitutions in menu items structure
tigra - 11/20/2003 at 10:17 PM

It is possible to reduce the size and make maintenance of menu items structure of Tigra Menu (all versions) easier by using javascript variable for repeating text. For example original structure is:

var MENU_ITEMS0 = [
['Description', '', {'tw':'_top'}],
['Features', '', {'tw':'_top'}],
['Compatibility List', '', {'tw':'_top'}],
['Files', '', {'tw':'_top'}],
['Building menu hierarchy', '', {'tw':'_top'},
['Item caption', '', {'tw':'_top'}],
['Item link', '', {'tw':'_top'}],
['Submenu block items ', '', {'tw':'_top'}]

we can replace repeating {'tw':'_top'} by JavaScript varialbe containing this structure:

var tw = {'tw':'_top'};
var MENU_ITEMS0 = [
['Description', '', tw],
['Features', '', tw],
['Compatibility List', '', tw],
['Files', '', tw],
['Building menu hierarchy', '', tw,
['Item caption', '', tw],
['Item link', '', tw],
['Submenu block items ', '', tw]

or we can even go further:

var tw = {'tw':'_top'};
var dc = '';
var MENU_ITEMS0 = [
['Description', dc + '#description', tw],
['Features', dc + '#features', tw],
['Compatibility List', dc + '#compatibility', tw],
['Files', dc + '#files', tw],
['Building menu hierarchy', dc + '#items', tw,
['Item caption', dc + '#items_caption', tw],
['Item link', dc + '/#items_link', tw],
['Submenu block items ', dc + '#items_subitems', tw]

now note that having the same result we significantly reduced the size of the structure. And you can adjust multiple items at once editing only one variable. You can have as many different substitutions as you wish.

Back to forum: