Problème is, I want my rendering to follow a path, as you can see in my 
"example".
Anyway, a recursive render helper is a good start I guess!
Maybe I should add a 'path' parameter helper to make something like :

function render_nested_set(Doctrine_Collection $collection, array $path)
{
  // ...
}

So I can use it this way :

echo render_nested_set($tree, array(1, 3, 7, 8)); ?

This way I can check every node, if its id is in my $path array, I render it... 
Something like that...

What do you think ?


Le 1 févr. 2010 à 16:57, Bernhard Schussek a écrit :

> You could, for instance, write a recursive render helper:
> 
> function render_nested_set(Doctrine_Collection $collection)
> {
>  $output = "<ul>\n";
> 
>  foreach ($collection as $record)
>  {
>    $output .= "<li>".$record; // __toString(), or whatever you like
> 
>    if ($record->getNode()->hasChildren())
>    {
>      $output .= "\n".render_nested_set($record->getNode()->getChildren());
>    }
> 
>    $output .= "</li>\n";
>    }
>  }
> 
>  return $output."</ul>\n";
> 
> }
> 
> 
> Bernhard
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/symfony-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to