Jump to content


Photo

Help with formating PHP results


  • Please log in to reply
5 replies to this topic

#1 Zoski

Zoski
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 September 2006 - 09:31 PM

Hello, I have a PHP script that is getting information from BF2s.com and displaying the results on my site.  The problem is that I have no idea ??? how to make the results display in a presentable fashion. Here is a link and you will see what I mean... http://www.zoski.com...battlefield.php
I would like to have the results in either a grid or at least with some space in between them.
Thanks for your help!!

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 09:35 PM

'Formatting' the output is just a matter of separating each piece of data for each row and adding space around them or placing each one separately in <td></td> cells with a new row for each row of results.

Legend has it that reading the manual never killed anyone.
My site

#3 Zoski

Zoski
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 September 2006 - 11:20 PM

The current code already is using the <td>:

function showList($sortby = 'score', $format = '<tr><td><a href="{LINK}">{NICK}</a></td><td>{SCORE}</td><td>{KDR}</td><td>{TIME}</td></tr>') {
$this->log("showList($sortby, $format )");

any ideas?

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 11:49 PM

then (re)define the opening html table so that it has cellpadding or cellspacing to suit your needs. For bonus points, define the style of text in a td element in a CSS style declaration in the html.
Legend has it that reading the manual never killed anyone.
My site

#5 Zoski

Zoski
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 03 September 2006 - 05:46 AM

Thanks for your guidance AndyB, I somehow managed to get it looking decent (Check it out). I will work on the bonus later.

Thanks!  :P

#6 sendoh07

sendoh07
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 September 2006 - 05:57 PM

Another method would be to using PEAR templating.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users