php中论坛帖子展开,书本知识看不懂啊靠~请帮帮小弟我

WBOY
풀어 주다: 2016-06-13 11:59:41
원래의
1014명이 탐색했습니다.

php中论坛帖子展开,书本知识看不懂啊靠~,请帮帮我,

<?php <br />// functions for loading, contructing and <br>// displaying the tree are in this file <br><br>class treenode<br>{ <br>  // each node in the tree has member variables containing <br>  // all the data for a post except the body of the message<br>  public $m_postid;<br>  public $m_title;<br>  public $m_poster;<br>  public $m_posted;<br>  public $m_children;<br>  public $m_childlist;<br>  public $m_depth;<br><br>  public function __construct($postid, $title, $poster, $posted, $children, <br>                    $expand, $depth, $expanded, $sublist)<br>  { <br>    // the constructor sets up the member variables, but more <br>    // importantly recursively creates lower parts of the tree<br>    $this->m_postid = $postid;<br>    $this->m_title = $title;<br>    $this->m_poster = $poster;<br>    $this->m_posted = $posted;<br>    $this->m_children =$children;<br>    $this->m_childlist = array();<br>    $this->m_depth = $depth;<br><br>    // we only care what is below this node if it <br>    // has children and is marked to be expanded<br>    // sublists are always expanded<br>    if(($sublist||$expand) && $children)<br>    {<br>      $conn = db_connect();<br><br>      $query = "select * from header where parent = $postid order by posted";<br>      $result = $conn->query($query);<br><br>      for ($count=0; $row = @$result->fetch_assoc(); $count++)<br>      {<br>        if($sublist||$expanded[ $row['postid'] ] == true)<br>          $expand = true;<br>        else<br>          $expand = false;<br>        $this->m_childlist[$count]= new treenode($row['postid'],$row['title'],<br>                                      $row['poster'],$row['posted'],<br>                                      $row['children'], $expand,<br>                                      $depth+1, $expanded, $sublist);<br>      }<br>    }<br>  }  <br><br><br>  function display($row, $sublist = false)<br>  {<br>    // as this is an object, it is responsible for displaying itself<br><br>    // $row tells us what row of the display we are up to <br>    // so we know what color it should be<br><br>    // $sublist tells us whether we are on the main page<br>    // or the message page.  Message pages should have <br>    // $sublist = true.  <br>    // On a sublist, all messages are expanded and there are<br>    // no "+" or "-" symbols.<br><br>    // if this is the empty root node skip displaying<br>    if($this->m_depth>-1)  <br>    {<br>      //color alternate rows<br>      echo '<tr>
<td></td>      if ($row%2) <br>        echo "'#cccccc'>";<br>      else<br>        echo "'#ffffff'>";<br><br>      // indent replies to the depth of nesting<div class="clear">
                 
              
              
        
            </div>
</tr>
로그인 후 복사
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!