function main_menu(items) {
output = '
'
for (item in items) {
i = items[item];
// Handle active page
if (i["active"]) {
active = ' class="active"';
} else {
active = '';
}
// Line break labels
/*label = i["label"];
if (label.search(" ") != -1) {
label = label.replace(" ", "
");
} else {
label = "
" + label;
}*/
// Add icon before labels
icon = '';
label = icon + i["label"];
output = output +'- ' + label + "
";
}
output = output + "
";
document.write(output);
}
function render_items(items) {
output = '';
for (item in items) {
i = items[item];
// Handle active page
if (i["active"]) {
active = ' class="active"';
// Add icon before labels
icon = '';
label = icon + i["label"];
} else {
active = '';
// Add icon before labels
icon = '';
label = icon + i["label"];
}
output = output +'- ' + label + "
";
if (i['subs']) {
output += render_items(i['subs']);
}
}
output = output + "
";
return output
}
function side_menu(items) {
if (items.length == 0) {
return 0;
}
output = render_items(items);
document.write(output);
}