Thursday, November 4, 2010

Tree Behavior

Hello folks,

I'm working with the tree behavior and having issues getting the
results to display more than the 'name' field in my table. I have
many additional fields that I've added and would like to display in
the view such as 'start_date','details'. If I print_r the $nodelist I
see:

Array ( [52] => Task #1 [54] => - Sub Task of Task #1 [53] => Task
#2 )

Here is my model:
<?php
class Projecttask extends AppModel {
var $name = 'Projecttask';
var $actsAs = array('Tree');
}
?>

Here is my Controller:
function index() {
$nodelist = $this->Projecttask->generatetreelist(null,null,null," -
");
$this->set('nodelist',$nodelist);
}

Here is my View:
<?
echo "<ul>";
foreach($nodelist as $key=>$value){
$editurl = $html->link("Edit", array('action'=>'edit', $key));
$upurl = $html->link("Up", array('action'=>'moveup', $key));
$downurl = $html->link("Down", array('action'=>'movedown', $key));
$deleteurl = $html->link("Delete", array('action'=>'delete',
$key));
echo "<li>[$editurl|$upurl|$downurl|$deleteurl] $value</li>";
}
echo "</ul>";
?>

Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: