<![CDATA[ Tree Javascript Menu (like the manager document tree) - MODX Community Forums]]> https://forums.modx.com/thread/?thread=35857 <![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200503
<?php
/* Simple version of the tree type javascript menu by bunk 58 (David Bunker) 24/05/08 */
$siteName = $modx->config['site_name'];

$nojsOutput = '<noscript>';

$jsOutput = '';
$jsOutput .= '<script type="text/javascript">
<!--
d = new dTree(\'d\');
d.add(0,-1,\'Your Menu\');';
$result = mysql_query('SELECT * FROM `modx_site_content` WHERE `published`="1" AND `hidemenu`="0" AND `deleted`="0" ORDER BY `menuindex` ASC ');
while($row = mysql_fetch_array($result)) {
	$jsOutput .= 'd.add( '. $row['id'] . ' , '. $row['parent'] . ' , \''. $row['pagetitle'] . '\', \'[~'. $row['id'] . '~]\');'."\n";
	$url = $modx->makeUrl($row['id']);
	$nojsOutput .= "<a href='$url'>{$row['pagetitle']}</a><br />";
}
$jsOutput .= '
document.write(d);
//-->
</script>';

$nojsOutput .= '</noscript>';
return ($jsOutput . "\n" . $nojsOutput);
?>


(untested)

or, well, do the noscript part simply with Wayfinder...
]]>
ganeshXL Oct 11, 2008, 02:47 PM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200503
<![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200502 The closest I can get is by setting
useCookies: true,

on line 36 of the dtree.js file, which means when you’ve clicked the + sign and then clicked through to a sub page the sub menu stays open.]]>
bunk58 Jul 16, 2008, 09:30 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200502
<![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200501
]]>
flanger Jul 16, 2008, 09:01 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200501
<![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200500 You couldn’t click on the link to open the sub menu because the link is to open the parent page.]]> bunk58 Jul 16, 2008, 08:57 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200500 <![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200499 flanger Jul 16, 2008, 05:31 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200499 <![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200498 Not sure about opening on clicking the doc/folder rather than the + sign, I’ll have a look at the JavaScript and report back.]]> bunk58 Jul 11, 2008, 11:10 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200498 <![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200497
How are the elements of the menu sorted? Seems like they are in a weired order...
greez
zven
]]>
flanger Jul 11, 2008, 09:56 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200497
<![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200496 But i have a question! wink. Im not in Javascript very much so i cant do it myself......
I wonder if its possible to open the menu tree without clicking on the "+" sing. I would prefer if the document tree would open by just clicking on the container...
Thanx for reply!
zven
]]>
flanger Jul 11, 2008, 09:36 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200496
<![CDATA[Re: Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200495 ]]> motsmart May 25, 2008, 02:14 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200495 <![CDATA[Tree Javascript Menu (like the manager document tree)]]> https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200494 It doesn’t use the excellent Wayfinder and offers limited features, but maybe of use to some.
See it in action on my sandbox.
The zip has instructions, it’s very straightforward to install.]]>
bunk58 May 24, 2008, 11:32 AM https://forums.modx.com/thread/35857/tree-javascript-menu-like-the-manager-document-tree#dis-post-200494