What I'm doing is creating classes to display a set of results from a database.
I have (from bottom to top)
1. result_cell (which is a value of an individual cell within a table)
2. result_field (which is a row of a table - ie. an array of result_cells)
3. result_set (which is an array of result_fields)
1 extends 2 and 2 extends 3.
Here is an implementation of the objects:
Code: Select all
$cell1 = new result_cell("First Name");
$cell2=new result_cell("Last Name");
$cell3=new result_cell("Age");
$field=new result_field(array($cell1, $cell2, $cell3), true); //true represents $is_title (see below)
$search_results=new result_set(array($field1));Any suggestions????
Secondly; in the display( ) method of each result_cell object, if $is_title is true, and the no URL has been specified for that particular cell, then the entire result_set will be sorted/re-ordered based on the data in that particular column. (Using another $data_type variable, I will call either a date_sort; int_sort; alpha_sort etc etc etc.), but each row is to contain the same data.
However; for this to work, I need to somehow be able to see ALL of the data in the grandparent (the result_set object); (which I can't do at the moment as I can't even see values in the parent of the cell object ).
Thanks in advance.