function showcolumnlist($columnid, $columnofarticleid = -1, $classindex = 0) { $query = "select childcolumn from I_column where id={$columnid}"; $result = getresult($query); $count = getresultNumrows($result); if ($classindex == 0) { $tempresult = getresult("select * from I_column where id={$columnid}"); $columnname = getresultData($tempresult, 0, "columnname"); //echo $columnname; if ($columnid == $columnofarticleid) { echo "<option selected=\"true\" value='" . $columnid . "'>\n"; } else { echo "<option value='" . $columnid . "'>\n"; } echo "{$columnname}</option>"; } if ($count > 0) { $childColumnId = getresultData($result, 0, "childcolumn"); //没有子栏目即返回 //echo $childColumnId."<br>"; if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") { if ($classindex == 0) { //echo "<option value='-1'>暂无栏目</option>"; } return false; } $childId = explode("|", $childColumnId); foreach ($childId as $id) { $getchildcolumnQuery = "select columnname,childcount from I_column where id={$id}"; $childColumn = getresult($getchildcolumnQuery); $childColumnname = getresultData($childColumn, 0, "columnname"); $childCount = getresultData($childColumn, 0, "childcount"); if ($id == $columnofarticleid) { echo "<option selected=\"true\" value='" . $id . "'>\n"; } else { echo "<option value='" . $id . "'>\n"; } echo space($classindex + 1) . $childColumnname . "</option>\n"; //如果为大栏目调整,则不递归显示子栏目 if ($columnid != 0) { showcolumnlist($id, $columnofarticleid, $classindex + 1); } } } else { return false; } }
$author = getresultData($result, 0, "author"); $source = getresultData($result, 0, "source"); $addtime = getresultData($result, 0, "addtime"); $notes = getresultData($result, 0, "notes"); $contents = getresultData($result, 0, "contents"); //消除单引号的bug $picurl = getresultData($result, 0, "picurl"); $ifpass = getresultData($result, 0, "ifpass"); ?> <form id="form1" name="form1" method="post" action="" onsubmit="return article_form_check()"> <table width="100%" cellspacing="0" cellpadding="3" border="1" bordercolor="#FFFFFF" style="border-collapse:collapse"> <tr> <td class='label'>所属栏目:</td> <td class='attributeinput'> <select name="columnid"><?php showcolumnlist($columnid, $columnofarticleid); ?> </select> </td> </tr> <tr> <td class='label'>文章标题:</td> <td class='attributeinput'><input value="<?php echo $title; ?> " type="text" name="title" /></td> </tr> <tr> <td class='label'>关键字:</td> <td class='attributeinput'><input value="<?php echo $keywords; ?>