Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Default closed nodes from db
bareAre
Junior Member

Posts: 2
Registered: 2/16/2006
Member Is Offline
posted on 2/16/2006 at 05:39 PM Reply With Quote
Default closed nodes from db


Hi

I use the PHP/MySQL way to fill the tree, and it works just fine.

I have about 8 top level categories, and I want their sub-nodes (children) to be hidden by default and all top level nodes to be expandable.

Basically, I want the opening screen to be like this:
+ Top Level Cat 1
+ Top Level Cat 2
+ .......
+ Top Level Cat 8

I hoped I could force the top node to be a kind of sub-node and get a + sign instead of the machine symbol, but that didnA?t do it. The code is below:


Code:

function build_hierarchy($id, $vn, $idfn, $pidfn, $cfn, $lfn) {
global $cat_tbl;
if ($id == 0) echo 'var '.$vn.' = [';
$sql = "SELECT * FROM $cat_tbl WHERE $pidfn=$id";
$result = q($sql);
if (mysql_num_rows($result) == 0) return;
while ($row = mysql_fetch_assoc($result)) {
if(!$vn) echo ',';
$vn = 0;
$clink = $row[$lfn];
$cid = $row[$idfn];
echo " ['$row[$cfn]', "javascript:linkCheck('$clink')", ";
if($id == 0) echo "{'st':'0','fn':'1'}";
else echo "0";
build_hierarchy($cid, $vn, $idfn, $pidfn, $cfn, $lfn);
echo ']';
}
mysql_free_result($result);
if($id == 0) echo "];";
}
View User's Profile View All Posts By User U2U Member
bareAre
Junior Member

Posts: 2
Registered: 2/16/2006
Member Is Offline
posted on 2/16/2006 at 06:55 PM Reply With Quote

Found solution in demo6.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004