|
#1
|
|||
|
|||
|
No More Empty Categories
This change would be cool to apply to future versions of PP. When creating categories, you may create photo categories that you have no photos for (call it future planning). Currently, PP shows ALL categories in the drop down box when browsing, regardless if you have no photos associated with each category. Make the following change to the "functions_browse.php" page and it will correct this issue.
On line 109 where it reads this: Code:
$query = mysql_query("SELECT * FROM ".$pixelpost_db_prefix."categories ORDER BY name");
Code:
$query = mysql_query("SELECT DISTINCT C1.id, C1.name, C1.alt_name FROM " .$pixelpost_db_prefix. "categories C1 INNER JOIN " .$pixelpost_db_prefix. "catassoc C2 ON C2.cat_id = C1.id ORDER BY C1.name");
Enjoy, Ken |
|
#2
|
||||
|
||||
|
Hi,
Sounds like a smart, clean idea to me. -Witty |
|
#3
|
|||
|
|||
|
Hi, this does sound good.. but I made the change and my empty cat still show up in browse
edit: ah, it's because I use darkmatter temlpate which has its own function for displaying categories. Darkmatter users who want to use this should edit dm_support.php line 216 from Code:
$cquery = mysql_query('select * from ' .$pixelpost_db_prefix . 'categories order by name asc');
Code:
$cquery = mysql_query("SELECT DISTINCT C1.id, C1.name, C1.alt_name FROM " .$pixelpost_db_prefix. "categories C1 INNER JOIN " .$pixelpost_db_prefix. "catassoc C2 ON C2.cat_id = C1.id ORDER BY C1.name asc");
|
|
#4
|
|||
|
|||
|
I noticed the same thing was happening when I switched over the the paged_archive addon. The same change (in my original post above) can be applied to line 570 in the paged_archive.php page.
Change: Code:
$query = mysql_query("SELECT * FROM ".$pixelpost_db_prefix."categories ORDER BY name");
Code:
$query = mysql_query("SELECT DISTINCT C1.id, C1.name, C1.alt_name FROM " .$pixelpost_db_prefix. "categories C1 INNER JOIN " .$pixelpost_db_prefix. "catassoc C2 ON C2.cat_id = C1.id ORDER BY C1.name");
|
| Post Reply |
| Thread Tools | |
|
|