Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:grapher-php [2020/11/01 14:54] babdev:grapher-php [2020/11/01 15:59] (current) bab
Line 419: Line 419:
         $pages =& $data['pages'];         $pages =& $data['pages'];
         $media =& $data['media'];         $media =& $data['media'];
- $root_name = $data['namespaces'];       + $root_name = array_values($pages)[0]["ns"];   
         $output = '{         $output = '{
    "root": "'. $root_name .'",    "root": "'. $root_name .'",
Line 433: Line 434:
             $output .= '"name" : "'. $title .'",'."\n";             $output .= '"name" : "'. $title .'",'."\n";
             $output .= '"value" : "'. $item['size'] .'",'."\n";             $output .= '"value" : "'. $item['size'] .'",'."\n";
-            $output .= '"type" : "'. substr($item['ns'],4) .'",'."\n";+            $output .= '"type" : "'. substr($item['ns'],4) .'"'."\n";
             if (!empty( $item['media'][0]))             if (!empty( $item['media'][0]))
             {             {
Line 439: Line 440:
  $file = count($path );  $file = count($path );
  $folder="";  $folder="";
- for($i=0 ; $< $file-1 ; $i++)+ for($n=0 ; $< $file-1 ; $n++)
  {  {
- $folder = $folder . $path[$i] . "/";+ $folder = $folder . $path[$n] . "/";
  }  }
- $output .= '"img" : "'. DOKU_INC. "data/media/" . $folder . "300x300-" . $path[$file-1] .'"'."\n";+ $output .= ',"img" : "'. DOKU_INC. "data/media/" . $folder . "300x300-" . $path[$file-1] .'"'."\n";
  }  }
            // $output .= '"has_conflict" : "'.$id.'"'."\n";            // $output .= '"has_conflict" : "'.$id.'"'."\n";
            // $output .= '"description" : "'.$id.'"'."\n";            // $output .= '"description" : "'.$id.'"'."\n";
             $output .= "}\n";             $output .= "}\n";
-            if ($i < count($pages)) $output .= ',';+            if ($i <count($pages)-1) $output .= ',';
                  
         }         }
Line 482: Line 483:
 $grapher = new Grapher(); $grapher = new Grapher();
 $grapher->run(); $grapher->run();
 +
  
  
  
 </file> </file>
  • dev/grapher-php.1604242464.txt.gz
  • Last modified: 2020/11/01 14:54
  • by bab