I'm in the early stages of learning OOP, and I figure PHP is as good as any to start (though my school coursework is Java). I want to do a practical application, so I thought I'd improve on an existing web site's menu navigation. I'd love some guidance in laying this out; I'm trying to grasp UML to do so.
What I want the class to do:
1. keep track of the 'layers' of categories/subcats of rows based on id/parent/subcat.
2. Be able to display these based on a paricular page one is at.
I currently pull from a database. The database has these fields already:
id = auto_increment via MySQL
parent = the parent of the item
subcat = originally written to indicate it belonged to a sub-category; might not need this
image = the path to the graphic of each title, if one exists
path = the path (URL) the item should point to
active = boolean; indicates if this should appear in menu or not
sequence = meant for mysql ordering; 1 indicates first in list, etc. etc, if no # defaults to alpha order
I was then naturally thinking of these variables:
var $id, $parent, $subcat, $image, $path, $active, $sequence;
I have a wrapper GUI, display.php, which has header content set up like so:
function head($szTitle='',$category='0',$scategory='0',$subsub='0',$subsubsub='0') {
global $szTitle, $category, $scategory, $subsub, $subsubsub;
$title = func_get_arg(0);
...where, when a page is called, we call the head function like so (example page is sitemap/index.php):
include('../display.php');
head('Sitemap','28','0');
...so I hope to, based on being on id 28 (parent 0), pull everything from that.
From here, I'm not really sure how I should proceed in fleshing out the class - ie. what things to think about. I'm really just at the modelling stage at the moment, as my OOP isn't nearly good enough to start constructing actual code.
Any pointers?
Thanks,
Eve