Beispiel #1
0
function articlecat_options($cat_id, $parent_id = 0, $level = 0)
{
    global $db, $prefix;
    $rows = $db->get_all("SELECT * FROM {$prefix}article_cat WHERE parent_id = ? ORDER BY sort_order", array($parent_id));
    foreach ($rows as $row) {
        $selected = $cat_id == $row['cat_id'] ? 'selected' : '';
        echo "<option value=\"{$row[cat_id]}\" {$selected} >" . str_repeat('&nbsp;', $level * 4) . "{$row[cat_name]}</option>";
        articlecat_options($cat_id, $row['cat_id'], $level + 1);
    }
}
Beispiel #2
0
?>
" method="post" enctype="multipart/form-data" name="theForm">
    <table width="100%" id="general-table">
      <tr>
        <td class="narrow-label">文章标题</td>
        <td><input type="text" name="title" size ="40" maxlength="60" value="<?php 
echo $title;
?>
" /><span class="require-field">*</span></td>
      </tr>
      <tr>
        <td class="narrow-label">文章分类</td>
        <td><select name="cat_id" >
            <option value="">请选择...</option>
            <?php 
articlecat_options($cat_id);
?>
          </select></td>
      </tr>
      <tr>
        <td class="narrow-label">文章重要性</td>
        <td><input type="radio" name="article_type" value="0" <?php 
if (0 == $article_type) {
    ?>
checked="checked"<?php 
}
?>
 /> 普通 <input type="radio" name="article_type" value="1" <?php 
if (1 == $article_type) {
    ?>
checked="checked"<?php 
Beispiel #3
0
" name="theForm"  onsubmit="return validate()">
<table cellspacing="1" cellpadding="3" width="100%">
  <tr>
    <td class="label">文章分类名称</td>
    <td><input type="text" name="cat_name" maxlength="60" size = "30" value="<?php 
echo $cat_name;
?>
" /></td>
  </tr>
  <tr>
    <td class="label">上级分类</td>
    <td>
      <select name="parent_id" >
        <option value="0">顶级分类</option>
        <?php 
articlecat_options($parent_id);
?>
      </select>
    </td>
  </tr>
  <tr>
    <td class="label">排序</td>
    <td>
      <input type="text" name='sort_order' value="<?php 
echo $sort_order;
?>
" size="15" />
    </td>
  </tr>
    <tr>
    <td class="label">是否显示在导航栏</td>