Jump to content

css'ing output = at least color every other row - mabye even fonts?


RobMichaelson

Recommended Posts

Hello All

 

I am desparately wanting to stylize my output - here is my code:

 

<?php[attachment=1368:apiToHtmlinJoomlaArticle2.PNG]
$url = "http://184.173.18.228/api/profile/1000/0/Adam.Adams";
$json = file_get_contents($url, 0, null, null);
$json_output = json_decode($json);
echo '<pre>';
//print_r("query results:");
//print_r($json_output);
'</pre>';
//$obj = array('section', 'fname', 'lname');
//var_dump($obj)
?>
<?php
function createTable(&$node, &$output, $key = NULL, $indent = 0) {
 if ($indent > 0) {
  $output .= "<tr>\n";
  $output .= "<td><strong>" . $key . "</strong></td>";
 } else {
  //$output .= '<tr><td>Top Level</td>';
 }
 if (is_object($node) || is_array($node)) {
  $node = (array)$node;
  $output .= "</tr>\n";
  $count = 0;
  foreach ($node as $k => $v) {
   createTable($node[$k], $output, $k, $indent + 1);
  }
 } else {
  $output .= "<td>" . ($node === TRUE ? 1 : $node === FALSE ? 0 : $node) . "</td>";
  $output .= "</tr>\n";
 }
}
function outputTable($object) {
 echo "<table border='0'>";
 $output = "";
 createTable($object, $output);
 echo $output;
 echo "</table>";
}
outputTable($json_output);
?>

 

not quite sure how - Im so used to ( at least) inline css -

 

attached is the output that I was even able to insert into a Joomla article

 

Thanks

Rob

post-138107-0-35213200-1359418375_thumb.png

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.