- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
Function GetChildTree($STARTID)
{
global $TPL_START_NOT_EMPTY;
$LEVEL_1_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$STARTID."' and visibility='1' order by priority desc");
if ($LEVEL_1_CHILD_ARRAY) // если массив не пустой
{
$i1=0;
$i2=0;
$i3=0;
$i4=0;
$i5=0;
$LEVEL_1_CHILD_HTML="";
$LEVEL_2_CHILD_HTML="";
$LEVEL_3_CHILD_HTML="";
$LEVEL_4_CHILD_HTML="";
$LEVEL_5_CHILD_HTML="";
while ($i1<count($LEVEL_1_CHILD_ARRAY))
{
$LEVEL_2_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_1_CHILD_ARRAY[$i1]['ID']."' and visibility='1' order by priority desc");
if ($LEVEL_2_CHILD_ARRAY)
{
while ($i2<count($LEVEL_2_CHILD_ARRAY))
{
$LEVEL_3_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_2_CHILD_ARRAY[$i2]['ID']."' and visibility='1' order by priority desc");
if ($LEVEL_3_CHILD_ARRAY)
{
while ($i3<count($LEVEL_3_CHILD_ARRAY))
{
$LEVEL_4_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_3_CHILD_ARRAY[$i3]['ID']."' and visibility='1' order by priority desc");
if ($LEVEL_4_CHILD_ARRAY)
{
while ($i4<count($LEVEL_4_CHILD_ARRAY))
{
$LEVEL_5_CHILD_ARRAY=nlst("Select ID, name from thread where parentID='".$LEVEL_4_CHILD_ARRAY[$i4]['ID']."' and visibility='1' order by priority desc");
if ($LEVEL_5_CHILD_ARRAY)
{
while ($i5<count($LEVEL_5_CHILD_ARRAY))
{
$ParseArray5[0]=$LEVEL_5_CHILD_ARRAY[$i5]['ID'];
$ParseArray5[1]=$LEVEL_5_CHILD_ARRAY[$i5]['name'];
$ParseArray5[2]="";
$LEVEL_5_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray5);
$i5++;
}
}
$ParseArray4[0]=$LEVEL_4_CHILD_ARRAY[$i4]['ID'];
$ParseArray4[1]=$LEVEL_4_CHILD_ARRAY[$i4]['name'];
$ParseArray4[2]=$LEVEL_5_CHILD_HTML;
$LEVEL_4_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray4);
$LEVEL_5_CHILD_HTML="";
$i4++;
}
}
$ParseArray3[0]=$LEVEL_3_CHILD_ARRAY[$i3]['ID'];
$ParseArray3[1]=$LEVEL_3_CHILD_ARRAY[$i3]['name'];
$ParseArray3[2]=$LEVEL_4_CHILD_HTML;
$LEVEL_3_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray3);
$LEVEL_4_CHILD_HTML="";
$i3++;
}
}
$ParseArray2[0]=$LEVEL_2_CHILD_ARRAY[$i2]['ID'];
$ParseArray2[1]=$LEVEL_2_CHILD_ARRAY[$i2]['name'];
$ParseArray2[2]=$LEVEL_3_CHILD_HTML;
$LEVEL_2_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray2);
$LEVEL_3_CHILD_HTML="";
$i2++;
}
}
$ParseArray1[0]=$LEVEL_1_CHILD_ARRAY[$i1]['ID'];
$ParseArray1[1]=$LEVEL_1_CHILD_ARRAY[$i1]['name'];
$ParseArray1[2]=$LEVEL_2_CHILD_HTML;
$LEVEL_1_CHILD_HTML.=ParseTPL($TPL_START_NOT_EMPTY, $ParseArray1);
$LEVEL_2_CHILD_HTML="";
$i1++;
}
}
echo $LEVEL_1_CHILD_HTML;
}