Required: CoolMenuPro
nice script to build a javascript menu
only vertical allignment atm
my goal is to build in all cool menu pro samples
Thx to Ralph for making even more confusing but i got most my errors out talking to him
v0.3 changes:
- oops forgot the link, added now
- also made a horizontal menu
v0.2 changes:
- correct displaying colors
- several small typo's in the loop
and here's the script:
chunk {{CoolMenuPro}} (should be placed in header)
/*
Cool Menu Pro 4 Etomite
v0.3
@author: Ruben Decleyn
@email: webmaster@mukke.org
*/
$id = isset($id) ? $id : $etomite->documentIdentifier;
$sortby = "menuindex";
$sortdir = "ASC";
$fields = "id, pagetitle, description, parent, alias";
$arrange = isset($arrange) ? $arange : "vertical";
function recursiveLoop($id,$sortby, $sortdir, $fields,$etomite)
{
$temp = "";
$children = $etomite->getActiveChildren($id, $sortby, $sortdir, $fields);
foreach($children as $child)
{
$temp .= '{code:"'.$child['pagetitle'].'", url:"[~'.$child['id'].'~]",'."\n";
if($etomite->getActiveChildren($child['id'], $sortby, $sortdir, $fields))
{
$temp .= "sub:[{},"."\n";
$temp .= recursiveLoop($child['id'],$sortby, $sortdir, $fields,$etomite);
$temp .= "],"."\n";
}
$len = strlen($temp);
$temp = substr($temp,0,$len-2);
$temp .= "},"."\n";
}
$len = strlen($temp);
$temp = substr($temp,0,$len-2);
return $temp;
}
$output = "
var STYLE_0 =
{
borderWidth:1,
borderColor:'#666666',
backgroundColor:[ 'black', '#B6BDD2' ],
backgroundClass:[ 'clsCMOn', 'clsCMOver' ],
size:[ 22, 100 ],
/*1{*/itemoff:[ '+previousItem-1px', 0 ]/*1}*/,
/*2{*/leveloff:[ 0, '+parentItem-1px' ]/*2}*/
};
var MENU_ITEMS = [
{pos:'relative', /*3{*/style:STYLE_0/*3}*/, blankImage:'assets/images/b.gif'},
"."\n";
$output .= recursiveLoop($id,$sortby, $sortdir, $fields,$etomite);
$output .= "]"."\n";
$output .= '
var menu1 = new COOLjsMenuPRO("menu1", MENU_ITEMS);
menu1.initTop();'."\n";
return $output;
Edited by Mukke, 01 February 2008 - 04:52 PM.











