Browse Source

fix bug

pull/61/head
xiaoz 3 years ago
parent
commit
bd32ed43de
  1. 17
      templates/admin/edit_category.php

17
templates/admin/edit_category.php

@ -30,16 +30,27 @@ @@ -30,16 +30,27 @@
<label class="layui-form-label">父级分类</label>
<div class="layui-input-block">
<select name="fid" lay-verify="">
<option value="<?php echo $category_one['fid']; ?>"><?php echo $category_one['fname']; ?></option>
<?php foreach ($categorys as $key => $category) {
<!-- 显示上级分类,如果没有,则显示空 -->
<?php if( empty( $category_one['fname'] ) ){
if ( $category['id'] == $category_one['fid'] ) {
?>
<!-- 如果上级分类名称为空 -->
<option value="0"></option>
<?php }else{ ?>
<option value="<?php echo $category_one['fid']; ?>"><?php echo $category_one['fname']; ?></option>
<option value="0"></option>
<?php } ?>
<!-- 显示上级分类END -->
<!-- 遍历所有分类,但不显示对应的父级 -->
<?php foreach ($categorys as $key => $category) {
if ( $category['id'] == $category_one['fid'] ) {
continue;
}
?>
<option value="<?php echo $category['id']; ?>"><?php echo $category['name']; ?></option>
<?php } ?>
<!-- 遍历所有分类END -->
</select>
</div>
</div>

Loading…
Cancel
Save