-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_dequi.php
More file actions
37 lines (30 loc) · 903 Bytes
/
menu_dequi.php
File metadata and controls
37 lines (30 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once (__DIR__.'/menu_class.php');
class Dequi extends Menu{
public function parent($data,$parent_id = 0, $char = ''){
foreach ($data as $key => $item) {
//Nếu là chuyên mục con thì sẽ hiển thị
// var_dump($item);
if($item['parent_id'] == $parent_id){
echo '<option value="'.$item['menu_id'].'">';
echo $char . $item['menu_name'];
echo '</option>';
unset($data[$key]);
$this->parent($data,$item['menu_id'],$char.'|--');
}
}
}
public function tree($data,$parent_id = 0,$char=''){
foreach ($data as $key => $item) {
if($item['parent_id'] == $parent_id){
echo '<tr>';
echo '<td>';
echo $char.$item['menu_name'];
$this->tree($data,$item['menu_id'],$char.'|--');
echo '</td>';
echo '</tr>';
}
}
}
}
?>