"; // check if the category has subcategories, or pics if ($catrow['showpics'] == true) { // get pictures from db $query = "SELECT id, name, filename FROM picture JOIN pic_cat ON (picture.id = pic_cat.pic_id) ". "WHERE pic_cat.cat_id = ". $cat ." ORDER BY pic_cat.position, picture.id"; $result = mysql_query($query); // for each subcategory, print a table column entry $numpicsinrow = 0; $numentries = 0; $entrytype = "pictures"; while ($picrow = mysql_fetch_assoc($result)) { $numpicsinrow++; $numentries++; if ($numpicsinrow == 6) { echo ""; $numpicsinrow = 1; } ?>





"; if ($pcrow[3] == $cat) echo "". $pcrow[0] .""; else echo $pcrow[0]; echo ""; if ($pcrow[1] == TRUE) { // this category has pictures, show how many echo " (". $pcrow[4] .")
"; } else { echo "
"; // get all subcategories $query = "SELECT id FROM category WHERE parent = ". $catid ." ORDER BY name_short"; $result = mysql_query($query); // recursive call to print subcategories while ($pcsubcatrow = mysql_fetch_array($result)) printcat($pcsubcatrow[0], $cat, $showlevel, $refnostats); } } } if ($branch == 2) printcat(2, $cat, $catrow['level'] + ($catrow['showpics'] == 0 ? 1 : 0), $refnostats); else printcat(2, $cat, 0, $refnostats); if ($branch == 3) printcat(3, $cat, $catrow['level'] + ($catrow['showpics'] == 0 ? 1 : 0), $refnostats); else printcat(3, $cat, 0, $refnostats); if ($branch == 4) printcat(4, $cat, $catrow['level'] + ($catrow['showpics'] == 0 ? 1 : 0), $refnostats); else printcat(4, $cat, 0, $refnostats); if ($branch == 34) printcat(34, $cat, $catrow['level'] + ($catrow['showpics'] == 0 ? 1 : 0), $refnostats); else printcat(34, $cat, 0, $refnostats); ?>
target="_parent"> Up

"; echo "
> " title= alt= />
"; } else { // get subcategories from db $query = "SELECT * FROM category WHERE parent = ". $cat ." ORDER BY name_short"; $result = mysql_query($query); // for each subcategory, print a table column entry $numsubcatsinrow = 0; $numentries = 0; $entrytype = "subcategories"; while ($subcatrow = mysql_fetch_assoc($result)) { // update counting variables $numsubcatsinrow++; $numentries++; // get the number of pictures or subcategories in this category if ($subcatrow['showpics'] == 0) { // no pictures, show the number of subcategories instead $query = "SELECT COUNT(*) FROM category WHERE parent = ". $subcatrow['id']; $crow = mysql_fetch_assoc(mysql_query($query)); $catcontent = $crow['COUNT(*)'] ." subcategories"; } else { // this category has pictures, let's count them $query = "SELECT COUNT(*) FROM pic_cat WHERE cat_id = ". $subcatrow['id']; $crow = mysql_fetch_assoc(mysql_query($query)); $catcontent = $crow['COUNT(*)'] ." pictures"; } // get the filename of the thumbnail picture for this category if ($subcatrow['primarypic_id'] == 0) { // there was no primary picture indicated, use default $primarypic = "./res/folder.gif"; } else { // a picture was indicated, retrieve the filename from the db $query = "SELECT filename FROM picture WHERE id = ". $subcatrow['primarypic_id']; $pprow = mysql_fetch_assoc(mysql_query($query)); $primarypic = "./Pics/thumbs/". $pprow['filename'] ."_thumb.jpg"; } // see if we have to start a new row if ($numsubcatsinrow == 6) { echo ""; $numsubcatsinrow = 1; } ?>
> alt= />
>
()
"; } // we are done with the database now mysql_close(); ?>
Total : |  Hits: | Last update: | Design by Chameleon