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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
<tr> <td height="40" align="center" valign="top" background="../images/menubg.jpg"><div class="colMenu"> <div id="myslidemenu" class="jqueryslidemenu"> <ul> <li><a href="index.php">ホーム</a></li>
<?php $cmd = "SELECT aboutusId FROM aboutus WHERE parentId=0 ORDER BY sortby ASC LIMIT 1"; $result = mysql_query($cmd); $row = mysql_fetch_array($result, MYSQL_ASSOC); $menu_aboutus = $row{'aboutusId'}; ?> <li><a href="aboutus.php?aboutusId=<?= $menu_aboutus?>">会社案内</a> <ul> <!-- SubMenu --> <? loadm1(0, 0, 1);
function loadm1($p, $space, $top) { $sql = "SELECT * "; $sql .= "FROM aboutus "; $sql .= "where parentid = $p "; $sql .= "order by sortby";
$result1 = mysql_query($sql); $n=1; $count = mysql_num_rows($result1); $num = mysql_num_rows($result1); if (($top<>1) && ($num > 0)) { echo "<ul>"; } while ($row = mysql_fetch_array($result1,MYSQL_ASSOC)) { echo "<li>"; if ($row{'aboutusdescjp'} == "") { // test and get if there are child underhood $sql_child = "SELECT aboutusId FROM aboutus WHERE parentid=".$row{'aboutusId'}." ORDER BY sortby ASC"; $child_res = mysql_query($sql_child); if(mysql_num_rows($child_res) ==0) echo "<a>". $row{'aboutusnamejp'} . "</a>"; else{ $a_child = mysql_fetch_array($child_res, MYSQL_ASSOC); $childid= $a_child{'aboutusId'}; echo "<a href='aboutus.php?aboutusId=$childid'>". $row{'aboutusnamejp'} . "</a>"; } } else { echo "<a href='aboutus.php?aboutusId=".$row{'aboutusId'}."'>". $row{'aboutusnamejp'} . "</a>"; } loadm1($row{'aboutusId'}, $space+1, 2); echo "</li>"; } if (($top<>1) && ($num > 0)) { echo "</ul>"; }
} ?> </ul> </li>
<?php $cmd = "SELECT productId FROM product WHERE parentId>0 ORDER BY parentId ASC, sortby ASC LIMIT 1"; $result = mysql_query($cmd); $row = mysql_fetch_array($result, MYSQL_ASSOC); $menu_product = $row{'productId'}; ?> <li><a href="product.php?productId=<?=$menu_product?>">取扱商品</a> <ul> <? loadm2(0, 0, 1);
function loadm2($p, $space, $top) { $sql = " select p.productId, sum(i.productimageId) as num, p.productcatnamejp"; $sql .= " from product p left join productimage i on p.productId = i.productId"; $sql .= " where p.parentid = $p "; $sql .= " group by p.productId, p.productcatnamejp "; $sql .= " order by p.sortby";
$result1 = mysql_query($sql); $n=1; $count = mysql_num_rows($result1); $num = mysql_num_rows($result1); if (($top<>1) && ($num > 0)) { echo "<ul>"; } while ($row = mysql_fetch_array($result1,MYSQL_ASSOC)) { echo "<li>"; if ($row{'num'} <> '') echo "<a href='product.php?productId=".$row{'productId'}."'>". $row{'productcatnamejp'} . "</a>"; else { // test and get if there are child underhood $sql_child = "SELECT productId FROM product WHERE parentid=".$row{'productId'}." ORDER BY sortby ASC"; $child_res = mysql_query($sql_child); if(mysql_num_rows($child_res) ==0) echo "<a>". $row{'productcatnamejp'} . "</a>"; else{ $a_child = mysql_fetch_array($child_res, MYSQL_ASSOC); $childid= $a_child{'productId'}; echo "<a href='product.php?productId=$childid'>". $row{'productcatnamejp'}. "</a>"; } } loadm2($row{'productId'}, $space+1, 2); echo "</li>"; } if (($top<>1) && ($num > 0)) { echo "</ul>"; }
} ?> </ul> </li>
<?php $cmd = "SELECT specialId FROM special WHERE parentId>0 ORDER BY parentId DESC, sortby ASC LIMIT 1"; $result = mysql_query($cmd); $row = mysql_fetch_array($result, MYSQL_ASSOC); $menu_special = $row{'specialId'}; if ($menu_special == "") { echo "<li><a href='#'>キャンベーン/特集一覧</a><ul>"; }else{ ?> <li><a href="special.php?specialId=<?=$menu_special?>">キャンベーン/特集一覧</a> <ul> <? } loadm3(0, 0, 1);
function loadm3($p, $space, $top) { $sql = " select p.specialId, sum(i.specialimageId) as num, p.specialcatnamejp"; $sql .= " from special p left join specialimage i on p.specialId = i.specialId"; $sql .= " where p.parentid = $p "; $sql .= " group by p.specialId, p.specialcatnamejp "; $sql .= " order by p.sortby";
$result1 = mysql_query($sql); $n=1; $count = mysql_num_rows($result1); $num = mysql_num_rows($result1); if (($top<>1) && ($num > 0)) { echo "<ul>"; } while ($row = mysql_fetch_array($result1,MYSQL_ASSOC)) { echo "<li>"; if ($row{'num'} <> '') echo "<a href='special.php?specialId=".$row{'specialId'}."'>". $row{'specialcatnamejp'} . "</a>"; else{ //echo "<a>". $row{'specialcatname'} . "</a></li>"; $a_spec = getLowerLevelFirstSpec( $row{'specialId'} ); $sqlt = "SELECT specialcatnamejp FROM special WHERE parentId=0"; $rowt = mysql_fetch_array(mysql_query($sqlt)); $s_name= $rowt[0];//$a_spec{'specialcatname'}; echo "<a href='special.php?specialId=".$a_spec{'specialId'}."'>". $s_name . "</a>"; } loadm3($row{'specialId'}, $space+1, 2); echo "</li>"; } if (($top<>1) && ($num > 0)) { echo "</ul>"; }
} function getLowerLevelFirstSpec( $id ){ $sqlCmd ="select p.specialId, sum(i.specialimageId) as num, p.specialcatname"; $sqlCmd .= " from special p left join specialimage i on p.specialId = i.specialId"; $sqlCmd .= " where p.parentid = $id "; $sqlCmd .= " group by p.specialId, p.specialcatname"; $sqlCmd .= " order by p.sortby"; //check does it have a product $tmprst = mysql_query($sqlCmd); if( mysql_num_rows($tmprst) > 0){ $row=mysql_fetch_assoc($tmprst); return $row; } //check if there are child product else{ $sqlCmd= "SELECT specialId FROM special WHERE parentid=$id ORDER BY sortby ASC"; $tmprst = mysql_query($sqlCmd); // there are child product in this category if(mysql_num_rows($tmprst) > 0) { $row= mysql_fetch_assoc($tmprst); return getLowerLevelFirstProd($row{'specialId'}); } else { return array("specialId"=>$id); } } } ?> </ul> </li>
<li><a href="news.php">ニュース/新着情報</a></li>
<li><a href="contactus.php">お問い合わせ</a></li> </ul> <br style="clear: left" /> </div> </div></td> </tr>
|