English 中文(简体)
我如何将护堤营地改装为#或son子? [闭门]
原标题:How can I convert frm php to c# or json? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers.

我正在使用。 例如,我的申请

I m 试图添加

我试图在一份单独的档案中确定两根树,我的主要档案是布局,需要在我手中的表格中添加这一(和其他)内容。

www.un.org/Depts/DGACM/index_spanish.htm 问题在于,Im使用蚊帐,而这个例子正在使用php。

我如何能够在互联网上开展这项工作?

我的守则是:

Ext.require([ * ]);

var store = Ext.create( Ext.data.TreeStore , {
    proxy: {
        type:  ajax ,
        url:  get-nodes.php 
    },
    root: {
        text:  Ext JS ,
        id:  src ,
        expanded: true
    },
    folderSort: true,
    sorters: [{
        property:  text ,
        direction:  ASC 
    }]
});

var tree = Ext.create( Ext.tree.Panel , {
    id:  tree ,
    store: store,
    width: 250,
    height: 300,
    columnWidth: 0.5,
    viewConfig: {
        plugins: {
            ptype:  treeviewdragdrop ,
            appendOnly: true
        }
    }
   // ,renderTo: document.body
});

var store2 = Ext.create( Ext.data.TreeStore , {
    proxy: {
        type:  ajax ,
        url:  get-nodes.php 
    },
    root: {
        text:  Custom Ext JS ,
        id:  src ,
        expanded: true,
        children: []
    },
    folderSort: true,
    sorters: [{
        property:  text ,
        direction:  ASC 
    }]
});

var tree2 = Ext.create( Ext.tree.Panel , {
    id:  tree2 ,
    width: 250,
    height: 300,
    columnWidth: 0.5,
    store: store2,
    viewConfig: {
        plugins: {
            ptype:  treeviewdragdrop ,
            appendOnly: true
        }
    }
   // ,renderTo: document.body
});


Ext.define("Ext.app.myTwoTrees",{
extend:"Ext.panel.Panel",

width : 600,
height: 350,
layout:  column ,
items: [
         tree , tree2
       ]

});

我在表态中称:

 Ext.create( Ext.app.myTwotrees )

这里是先天。 php

<?php
// from php manual page
function formatBytes($val, $digits = 3, $mode =  SI , $bB =  B ){ //$mode ==  SI | IEC , $bB ==  b | B 
   $si = array(  ,  K ,  M ,  G ,  T ,  P ,  E ,  Z ,  Y );
   $iec = array(  ,  Ki ,  Mi ,  Gi ,  Ti ,  Pi ,  Ei ,  Zi ,  Yi );
   switch(strtoupper($mode)) {
       case  SI  : $factor = 1000; $symbols = $si; break;
       case  IEC  : $factor = 1024; $symbols = $iec; break;
       default : $factor = 1000; $symbols = $si; break;
   }
   switch($bB) {
      case  b  : $val *= 8; break;
      default : $bB =  B ; break;
   }
  for($i=0;$i<count($symbols)-1 && $val>=$factor;$i++)
       $val /= $factor;
  $p = strpos($val,  . );
   if($p !== false && $p > $digits) $val = round($val);
   elseif($p !== false) $val = round($val, $digits-$p);
   return round($val, $digits) .     . $symbols[$i] . $bB;
}

// grab the custom params
$path = isset($_REQUEST[ path ])&&$_REQUEST[ path ] ==  extjs  ?  ../../../  :  ../../ ;

$node = isset($_REQUEST[ node ]) ? $_REQUEST[ node ] :   ;
   $isXml = isset($_REQUEST[ isXml ]);

if(strpos($node,  .. ) !== false){
   die( Nice try buddy. );
}

$nodes = array();
$directory = $path.$node;
   if (is_dir($directory)){
       $d = dir($directory);
        while($f = $d->read()){
            if($f ==  .  || $f ==  ..  || substr($f, 0, 1) ==  . ) continue;

    $filename = $directory .  /  . $f;
    date_default_timezone_set( America/Los_Angeles );
    $lastmod = date( M j, Y, g:i a , filemtime($filename));

    if(is_dir($directory. / .$f)){
        $qtip =  Type: Folder<br />Last Modified:  .$lastmod;
        $nodes[] = array(
             text  => $f,
             id    => $node. / .$f,
             cls   =>  folder 
        );
    } else {
        $size = formatBytes(filesize($filename), 2);
        $qtip =  Type: JavaScript File<br />Last Modified:  .$lastmod. <br />Size:  .$size;
        $nodes[] = array(
             text  => $f,
             id    => $node. / .$f,
             leaf  => true,
             cls   =>  file 
        );
    }
}
$d->close();
}

if ($isXml) {
    $xmlDoc = new DOMDocument();
    $root = $xmlDoc->appendChild($xmlDoc->createElement("nodes"));
    foreach ($nodes as $node) {
    $xmlNode = $root->appendChild($xmlDoc->createElement("node"));
    $xmlNode->appendChild($xmlDoc->createElement("text", $node[ text ]));
    $xmlNode->appendChild($xmlDoc->createElement("id", $node[ id ]));
    $xmlNode->appendChild($xmlDoc->createElement("cls", $node[ cls ]));
    $xmlNode->appendChild($xmlDoc->createElement("leaf", isset($node[ leaf ])));
}
header("Content-Type: text/xml");
$xmlDoc->formatOutput = true;
echo $xmlDoc->saveXml();
} else {
    echo json_encode($nodes);
}
最佳回答

我建议你把这个问题分为两部分:

(1) 更改<代码>url: 编号: to url: my-dotnet-url并作此改动。 NET page 回流静止的JSON或XML(硬编码树值)

That will confirm all your javascript, resources, etc. is working properly and that you are only asking a .NET question about how to output certain data.

2) 然后发现一个“网络”的例子,使你能够从获得数据的地方创建“JSON”或“XML”(很可能是一个数据库)。 你们只需看一看你正确运作的静态数据。 如果你不了解多少购买力平价。 NET 学习。 要使你的产出正确,网络比试图从这个例子中赶走更容易。 如果你坐下来,我再提出一个不同的问题,并询问如何以动态的方式编制从这一静态档案中得出的数据,而没有牵涉极端复杂因素的数据!

Hope this helps.

问题回答

Try Dextop。 它为伙伴关系之间的联系提供了一个应用框架。 NET and Ext JS.





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签