PDA

View Full Version : Complicating Ext Dependency Builder?



BBabb
4 Oct 2007, 12:23 PM
I am using the example for the documents for Ext Dependency Builder. But of cource i'm complicating it now so instead of doing a directory browse i want it to read MySQL table structures.

Here is the dependencies.php i wrote (which the array seems correct)

$tables=mysql_query("show tables") or die(mysql_error());
$tmp="";
$nodes = array();
while($t=mysql_fetch_assoc($tables)) {
foreach ($t as $db => $table) {
if(empty($tmp) || $tmp != $table) {
$node = $table;
$nodes[] = array('text'=>$node, id=>$node, qtip=>"Table:".$node, iconCls=>'folder', allowDrag=>false);
}
$cells=mysql_query("SHOW COLUMNS FROM ".$table) or die(mysql_error());
while($c=mysql_fetch_assoc($cells)) {
$nodes[] = array('text'=>$c['Field'], id=>$node.'.'.$c['Field'], leaf=>true, qtip=>"Type: ".$c['Type'], qtipTitle=>$c['Field'], cls=>'file', allowDrag=>true);
}
$tmp = $table;
}
}
echo json_encode($nodes);


I haven't changed anything else. Can you give me some reason why it doesn't work?

BBabb
4 Oct 2007, 3:03 PM
OK I know it's a JSon error that i don't have it, and i know that my client will not have it nor will they upgrade. How can i make a tree using the XML.
Sorry new to EXT

evant
4 Oct 2007, 3:04 PM
Search the forum, there are lots of discussions regarding this.

JeffHowden
4 Oct 2007, 6:47 PM
Instead of converting to XML, you could always download the stand-alone functions that make encoding your data as JSON possible.