I guess I am learning PHP and learning it well now (I am not even missing PERL anymore). Well I commented out all the code shown before. Now I am back in control. While it was a great feature it really killed the performance on my site. So I had to get rid of it. I am still using the categories/subcategories feature and it works like charm. Now only I wish if I could figure out how to take the background color out of this table since I am getting some whitespace
//get num of links in root category (and its subcats) (ALL-ALWAYS)
// foreach ($roots as $roots_id){
// $root_count_array_total[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id.")");
//the same,but only PUBLISHED
// if ($status_mode=="published"){
// $root_count_array[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=3 AND (link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id."))");
//the same,but only QUEUED
// }elseif ($status_mode=="queued"){
// $root_count_array[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=2 AND (link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id."))");
//all
// }else {
// $root_count_array=$root_count_array_total;
// }
// }
//compare and set root ids with subcats
Quote:
Originally Posted by jatboy26 Is there a way to disable counts for categories and subcategories? Basically if I use your code I get to see for example Entertainment [5/12]
I would like to disable the [5/12] as it may be increasing my server load and slowing down my site. Kindly suggest. |