Results 1 to 2 of 2

Thread: parents

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jan:2006
    Location:
    Posts: 77

    parents

    , .
    . parent . parent-, ...
    parent, , child- parent- . :

    "child2" parent , parent-. ... .

    , ...
    class, . .
    Code:
    <?php 
    require_once('classes/GDRenderer.php'); 
    include 'global.php';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
    mysql_query('set names cp1251', $conn);
    mysql_select_db($dbname);
    $getparents = mysql_query("SELECT DISTINCT parent FROM table ORDER BY child DESC");
    while($row = mysql_fetch_assoc($getparents)){
    	$parent[] = $row[parent];
    }
    $i=1;
    $p=1;
    $c=0;
    $objTree = new GDRenderer(20, 10, 30, 75, 12); 
    foreach ($parent as &$value){
    	$getchilds = mysql_query("SELECT * FROM table WHERE parent='$value' ORDER BY child DESC");
    //    (id,parentid,title,name,width)
    	$objTree->add($i,$c,'parent','', 100); 
    	$i++;
    	while($row = mysql_fetch_assoc($getchilds)){
    		$objTree->add($i,$p,'child'.$i.'','', 75); 
    		$i++;
    	}
    		$c = 0;
    		$p = $i;
    }
    $objTree->setBGColor(array(255, 255, 255)); 
    $objTree->setNodeTitleColor(array(0, 128, 255)); 
    $objTree->setNodeMessageColor(array(0, 192, 255)); 
    $objTree->setLinkColor(array(0, 64, 128)); 
    $objTree->setNodeBorder(array(0, 0, 0), 1); 
    $objTree->setFTFont('../fonts/SVBasicManual.ttf', 8, 0, GDRenderer::CENTER|GDRenderer::CENTER); 
    
    $objTree->stream(); 
    
    ?>
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Untitled-1.png‎ 
Views:	84 
Size:	3.6 KB 
ID:	20133  

  2. #2
    Registered User
    Join Date: Aug:2006
    Location:
    Posts: 4,052
    BFS DFS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |