header script type text javascript function toogle_alf id parent id sl

 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
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
header:
<script type="text/javascript">
function toogle_alf(id){
$("#parent"+id).slideToggle();
}
</script>
sidebar.php:
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="215" height="271" align="left" valign="top" background="<?php bloginfo('template_directory'); ?>/img/fon_left.jpg"><table width="215" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="42"></td>
<td>
<?php include (TEMPLATEPATH . '/searchform_bar.php'); ?>
</td>
<td width="17">&nbsp;</td>
</tr>
<?php
$cats = get_categories();
$parents = array(3,4);
$flag = 0;
foreach ((array)$cats as $cat) {
if (($flag == 1) and (!in_array($cat->parent, $parents))){
$flag = 0;
echo '<img src="';
bloginfo('template_directory');
echo '/img/menu_razd.jpg" width="215" height="3" border="0" /></div>
</tr>';
}
if (in_array($cat->parent, $parents)) {
echo '<a href="' . get_category_link($cat->cat_ID) . '">' . $cat->cat_name . '</a> ';
} else {
echo '<tr>
<td width="42"></td>
<td width="156" class="menu">
<a href="' . get_category_link($cat->cat_ID) . '"';
if (in_array($cat->cat_ID, $parents)) echo ' onclick="toogle_alf('.$cat->cat_ID.'); return false;"';
echo '>' . $cat->cat_name . '</a>
</td>
<td width="17">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><img src="';
bloginfo('template_directory');
echo '/img/menu_razd.jpg" width="215" height="3" border="0" /></td>
</tr>';
}
if (in_array($cat->cat_ID, $parents)){
echo '<tr><td colspan="3"><div class="alf" id="parent'.$cat->cat_ID.'">';
$flag = 1;
}
}
if ($flag == 1){
$flag = 0;
echo '</div></td></tr>';
}
?>
</table></td>
style.css:
.alf {
display:none;
padding:0 17px 0 50px;
}
.alf img {
margin:0 -17px 0 -50px;
}