<?php
class menu {
- var $data = array();
+ private $data = array();
- function draw() {
+ function __construct($data = null) {
+ if (!is_null($data)) $this->data = $data;
+ }
+
+ function draw($data) {
+ echo "<ul>";
+ foreach($data as $key=>$val) {
+ echo "<li>";
+ if (is_array($val)) {
+ echo $key;
+ echo " -> ";
+ $this->draw($val);
+ } else {
+ echo $key;
+ echo " -> ";
+ echo $val;
+ }
+ echo "</li>";
+ }
+ echo "<ul>";
+ }
+
+ function run() {
+ $this->draw($this->data);
}
}
?>