10 Einträge, 1 Seite |
1
2
3
4
5
6
7
foreach $category (@categories) {
if ($category =~ /^([^:]+):/) {
$category = $1;
}
push (@categories_to_print, $category) unless $categories_to_print[$#categories_to_print] eq $category;
}
my @categories_to_print = (sort @categories_to_print);
1
2
3
4
5
6
7
my $cat = $categories_to_print[$j];
my @kategorien = kategorie_liste_holen ($cat);
my @kategorie_zeilen = @kategorien ?
map $CGI->td( " " , $_ ), @kategorien :
$CGI->td( "keine Liste" );
print $CGI->Tr( [@kategorie_zeilen
] );
1
2
3
4
5
6
7
8
9
10
11
12
sub kategorie_liste_holen {
my $cat = shift;
my @sub_categories_to_print;
foreach my $category (grep { /^$cat:/; } @categories) {
if ($category =~ /^($cat:[^:]+):/) {
$category = $1;
}
push (@sub_categories_to_print, $category) unless $sub_categories_to_print[$#sub_categories_to_print] eq $category;
}
return @sub_categories_to_print;
}
1
2
3
4
5
my @categories_to_print;
foreach my $line ( @categories ) {
my ( $art, $marke, $modell ) = split ":", $line;
push (@categories_to_print, [$art, $marke, $modell] );
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
my $categories = [
['Autos',
['Opel',
['Astra', 'Corsa',],
],
],
['Motorräder',
['Kawa',
['xx1',],
],
['Susi',
['600',
['xx1',],
],
],
['Susi',
['750',
['xx1',],
],
],
],
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
my $categories = {
'001' => {
'title' => 'Autos',
'parent' => '',
'children => ['Opel', ],
},
'002' => {
'title' => 'Opel',
'parent' => 'Autos',
'children' => ['Astra', 'Corsa',],
},
'003' => {
'title' => 'Astra',
'parent' => 'Opel',
'children' => [],
},
'004' => {
'title' => 'Corsa',
'parent' => 'Opel',
'children' => [],
},
};
10 Einträge, 1 Seite |