]> git.nbdom.net Git - nb.git/commitdiff
out
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 15 Mar 2016 16:21:13 +0000 (17:21 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 15 Mar 2016 16:21:13 +0000 (17:21 +0100)
lib/php/out.php

index ad9c2073cb0ca4646723aaa3315be11408aba8c1..4728ac77515e2cdc66d829ee3ec523b8a62e472c 100644 (file)
@@ -170,7 +170,7 @@ function out_csv_head(&$row,$o) {
 #function out_tag_head(&$row,$o) { return ''; }
 function out_tag_head(&$data,$o) {
 #return var_dump($row,true); return '';
-  $o['tag'] = isset($o['tag_head']) ? $o['tag_head'] : $o['tag'];
+  if (empty($o['tag']) and isset($o['tag_head'])) $o['tag'] = $o['tag_head']; 
   $row = out::ar_first($data);
   if (!out::is_hash($row)) $row = $data;
   if (!is_array($row)) return 0;
@@ -181,18 +181,25 @@ function out_tag_head(&$data,$o) {
 function out_tag(&$row,$o) {
 #var_dump($row); return '';
 # NB 07.03.16   if (!is_array($row)) return var_export($row,true);
+  if (isset($o['tag_enclose'])) echo '<'.$o['tag_enclose'].'>'.PHP_EOL;
   foreach ($row as $k => $v) {
     #if (!is_scalar($v)) continue;
 # NB 07.03.16     if (!is_scalar($v)) return var_export($row,true);
-    $k = empty($o['tag']) ? $k : $o['tag'];
-    return ''
+    if (!empty($o['tag'])) {
+      $class = ' class="'.$k.'"';
+      $k = $o['tag']; 
+    } else {
+      $class = '';
+    }
+    echo ''
       .(OUT_EOL ? '  ' : '')
-      .(isset($o['tag_enclose']) ? '<'.$o['tag_enclose'].'>' : '')
-      ."<$k>$v</$k>"
-      .(isset($o['tag_enclose']) ? '</'.$o['tag_enclose'].'>' : '')
+      #.(isset($o['tag_enclose']) ? '<'.$o['tag_enclose'].'>' : '')
+      ."<$k$class>$v</$k>"
+      #.(isset($o['tag_enclose']) ? '</'.$o['tag_enclose'].'>' : '')
       .OUT_EOL
     ;
   }
+  if (isset($o['tag_enclose'])) echo '</'.$o['tag_enclose'].'>'.PHP_EOL;
 }
 
 function out_xml(&$row,$o) {