Hi, I was having a problem on displaying other fields for my 'Category' model using the tree helper, like this
name description -------- ----------------- Car All about cars -New New cars -Used Pre owned cars the tree helper can display the first field nicely but not the other fields in the model. This is my first try, thought I extend the tree helper a bit to allow other fields to be displayed. Here portion of it goes; <pre> function show($name, $data, $arrayOfFields = null)) { list($modelName, $fieldName) = explode('/', $name); $output = $this->list_element($data, $modelName, $fieldName, 0, $arrayOfFields); return $this->output($output); } function list_element($data, $modelName, $fieldName, $level, $arrayOfFields=null) { $tabs = "\n" . str_repeat($this->tab, $level * 2); $li_tabs = $tabs . $this->tab; $output = $tabs. "<ul>"; foreach ($data as $key=>$val) { if(!is_null($arrayOfFields)) { foreach($arrayOfFields as $key=>$otherField){ $text .= '  ' . $val[$modelName][$otherField]; } } $output .= $li_tabs . "<li>".$val[$modelName][$fieldName]; if(isset($val['children'][0])) { $output .= $this->list_element($val['children'], $modelName, $fieldName, $level+1, $arrayOfFields); $output .= $li_tabs . "</li>"; } else { $output .= "</li>"; } } $output .= $tabs . "</ul>"; return $output; } </pre> Now if only it can be displayed in table format... Comments appreciated. mamato. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---