ufaclub
Полезный
- Регистрация
- 1 Май 2007
- Сообщения
- 395
- Реакции
- 19
- Автор темы
- #1
как ?
PHP:
<?
if (@$_GET['city']){
$GLOBALS['start_for_links'] = "city/".htmlspecialchars($_GET['city'])."/";
$GLOBALS['end_for_links'] = "sort/city_asc/page/1/";
}
else {
$GLOBALS['start_for_links'] = ""; $GLOBALS['end_for_links'] = "sort/date_desc/page/1/";
}
$GLOBALS['host'] = $h; $GLOBALS['count'] = 0;
function listcat2($id, $sub, $count)
{
$categories = mysql_query("SELECT * FROM jb_board_cat WHERE root_category = $id ORDER by sort_index"); cq();
while($category = mysql_fetch_assoc($categories))
{
echo ($category['img']!="")?"<img align=left src=\"".$GLOBALS['host']."/upload/cat/".$category['img']."\">":" ";
$kolvo = mysql_num_rows(mysql_query("SELECT id from jb_board WHERE id_category = '".$category['id']."'")); cq();
if ($kolvo) echo "<a href=\"".$GLOBALS['host']."/advertisement/".@$GLOBALS['start_for_links']."nesting/".$category['id']."/".@$GLOBALS['end_for_links']."\">".$category['name_cat']." [".$kolvo."]</a><br />";
else echo $category['name_cat']."<br />";
$GLOBALS['count'] = $GLOBALS['count'] + $kolvo; listcat2($category['id'], $sub+1, $GLOBALS['count']);
}
}
$categories = mysql_query("SELECT * FROM jb_board_cat WHERE root_category = 0 ORDER by sort_index"); cq();
$GLOBALS['tdEnd'] = round(mysql_num_rows($categories) / 2);$GLOBALS['count_rows'] = 0;
echo "<table width=100%><tr valign=top><td width=50% style=\"padding-right:10px;\">";
while($category = mysql_fetch_assoc($categories))
{
echo "<div style=\"margin-top:15px;\">";
echo ($category['img']!="")?"<div style=\"float:left; margin-right:10px; \"><img align=left src=\"".$GLOBALS['host']."/upload/cat/".$category['img']."\"></div>":" ";
echo "<H4><a href=# onClick=\"showhide('9999".$category['id']."','9s9".$category['id']."');return false;\" style=\"cursor:pointer\">".$category['name_cat']."</a> <span id=count_".$category['id']."></span></H4><div id=\"9s9".$category['id']."\" style=\"DISPLAY: block;\">".$category['description']."</div><div id=\"9999".$category['id']."\" style=\"DISPLAY: none; padding-left:0px\">";
$sub = 1;
listcat2($category['id'], $sub, $GLOBALS['count']);
echo "</div>";
if ($GLOBALS['count'] != 0) echo "<script type=\"text/javascript\">document.getElementById('count_".$category['id']."').innerHTML = '".$GLOBALS['count']."';</script>";
$GLOBALS['count'] = 0;
echo "</div>";
$GLOBALS['count_rows'] ++;
if ($GLOBALS['count_rows'] % $GLOBALS['tdEnd'] == "0") echo "</td><td width=50%>";
}
echo "</td></tr></table>";
?>
<BR>