home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
General Forums
OffTopic
Server console - 27-10-2010 - Alpha out now!
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="joz" data-source="post: 560681" data-attributes="member: 70244"><p><strong>Re: Server console (again <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" />)</strong></p><p></p><p>And there you have it!</p><p>I figured out how to build up the proper array with PHP based upon a correctly formed MySQL nestedset result.</p><p>here you have it (credit goes to emil, colleague);</p><p>[php]</p><p> $menu = $this->getSubTree(fetchAll($query));</p><p> return $menu[0]['children'];</p><p> }</p><p> </p><p> private function getSubTree(&$nodes, $prevNodeRgt = false){</p><p> while($node = current($nodes)){ </p><p> if((!$prevNodeRgt ? $node['rgt'] : $prevNodeRgt) < $node['rgt']) return $tree;</p><p></p><p> next($nodes);</p><p></p><p> //Has children? </p><p> if($node['rgt'] - $node['lft'] > 1) $node['children'] = $this->getSubTree($nodes, $node['rgt']); </p><p></p><p> $tree[] = $node; </p><p> }</p><p> return $tree; </p><p> }</p><p>[/php]</p><p></p><p>Some more good news; Lord Alderaan (utorrent forum user) pointed me to one of his own projects that might help me tackle the login stuff faster. Have to wait for his project page being back online though <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="joz, post: 560681, member: 70244"] [b]Re: Server console (again ;))[/b] And there you have it! I figured out how to build up the proper array with PHP based upon a correctly formed MySQL nestedset result. here you have it (credit goes to emil, colleague); [php] $menu = $this->getSubTree(fetchAll($query)); return $menu[0]['children']; } private function getSubTree(&$nodes, $prevNodeRgt = false){ while($node = current($nodes)){ if((!$prevNodeRgt ? $node['rgt'] : $prevNodeRgt) < $node['rgt']) return $tree; next($nodes); //Has children? if($node['rgt'] - $node['lft'] > 1) $node['children'] = $this->getSubTree($nodes, $node['rgt']); $tree[] = $node; } return $tree; } [/php] Some more good news; Lord Alderaan (utorrent forum user) pointed me to one of his own projects that might help me tackle the login stuff faster. Have to wait for his project page being back online though :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
General Forums
OffTopic
Server console - 27-10-2010 - Alpha out now!
Contact us
RSS
Top
Bottom