I am creating a message board (pretty standard) using php and mysql.  In
order to manage all the posts and replies I am using a treenode structure
(so that I can recursively add, delete, display, etc...) Everything works so
far (www.bleen.net/forum).  I want to be able to display 10 posts (including
relies in that count) at a time; then have a next link and display the next
10 (you've all seen it before).  How do I modify a recursive function to
stop and start?  My display finction is listed below.

Alexander Ross

function display($row, $start = 0)
{ //display the tree
  { // if this is the empty root node skip displaying
    print "<tr><td bgcolor=";
 if ($row%2 == 0)
   print "'#cccccc'>";
   print "'#ffffff'>";

  // indent replies to the depth of nesting

  print "<img src='images/spacer.gif' height=22
width=".(22*$this->m_depth)." alt='' valign = bottom>";
  print " <a name = $this->m_postid ><a href =
  if ($this->m_depth == 1)
    print "<b> '$this->m_title' - $this->m_poster
    print "'$this->m_title' - $this->m_poster
  print "</td></tr>";
  // increment row counter to alternate colors

  $num_children = count($this->m_childlist);
  for($i = 0; ($i<$num_children); $i++)
  { // call display on each of this node's children
    $row = $this->m_childlist[$i]->display($row);

  return ($row);

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to