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.
Thanks Alexander Ross function display($row, $start = 0) { //display the tree if($this->m_postid<>0) { // if this is the empty root node skip displaying print "<tr><td bgcolor="; if ($row%2 == 0) print "'#cccccc'>"; else 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 = 'view_post.php?postid=$this->m_postid'>"; if ($this->m_depth == 1) print "<b> '$this->m_title' - $this->m_poster <i>(".reformat_date($this->m_posted).")</i></b></a>"; else print "'$this->m_title' - $this->m_poster <i>(".reformat_date($this->m_posted).")</i></a>"; print "</td></tr>"; } // increment row counter to alternate colors $row++; $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