require_once('table.inc');
require_once('table_data_array.inc');
require_once('table_render_html.inc');
class MyRender extends Table_Render_HTML {
function render_element_email($email) {
?>| =$email?> |
}
function render_element_url_title($title) {
$url = $this->row['url'];
?>=$title?> |
}
function render_element_cost($cost) {
?>=sprintf("$%02.2f",$cost)?> |
}
function render_total_cost($cost) {
?>=sprintf("$%02.2f",$cost)?> |
}
function render_header_url_title($value) {
$this->render_header("URL",$value);
}
};
$foo = array(
array(id => "1", name => "Richard", email => "richard@blah.com", url => "http://dododo.com/", url_title => "DoDoDo", cost => "50.00"),
array(id => "2", name => "Adam", email => "adam@blah.com", url => "http://yahoo.com/", url_title => "Yahoo", cost => "75.00"),
array(id => "3", name => "Colin", email => "colin@blah.com", url => "http://google.com/", url_title => "Google", cost => "12"),
array(id => "4", name => "Andrew", email => "andrew@blah.com", url => "http://exorsus.net/", url_title => "Exorsus", cost => "99.5"),
array(id => "5", name => "Josh", email => "josh@blah.com", url => "http://slashdot.org/", url_title => "Slashdot", cost => "1000000.00"),
);
$t = new Table(
new Table_Data_Array($foo,array("name","email","url_title","cost"),"id"),
new MyRender("normal","shaded","total")
);
$t->render();
?>