Number Of Sub-Categories And Links
Jan 18
JojoMart, a member from Site Sift forums has made a modification which allows you to show up number of sub categories and number of links in each of the categories. It will show up something like:
Web Directories (24) (150) wherein “Web Directories” is the category, (24) is the number of sub categories and (150) is number of links.
It’s a mod alright, but i haven’t had any review so far on this mod from other members. So if you are installing this, please backup your files. And take care of it… Do it on your own risk. And please, please, don’t hold me liable if anything goes wrong…
Thanks.
Alright, so here is how the thing goes:
1. Take your backup of the files.
2. Open subcat.php
3. Find the code:
while($subcategory = mysql_fetch_assoc($subcat)){
//fetch children
$sql = “select * from pages where active = ‘Yes’ and catID = ‘” . $subcategory['id'] . “‘”;
//echo $sql;
$R = mysql_query($sql,$myconn) or die(mysql_error());
//print children links and total subcategories of children
$sql = “select * from settings where id = ‘1′”;
$S = mysql_query($sql,$myconn);
$settings = mysql_fetch_assoc($S);
if($settings['stats'] == ‘1′)
$stats = ‘ (‘.mysql_num_rows($R).’)';
4. Replace the code with:
while($subcategory = mysql_fetch_assoc($subcat)){
//fetch children
$sql = “select * from pages where active = ‘Yes’ and catID = ‘” . $subcategory['id'] . “‘”;
//echo $sql;
$R = mysql_query($sql,$myconn) or die(mysql_error());
//print children links and total subcategories of children
$sql = “select * from settings where id = ‘1′”;
$S = mysql_query($sql,$myconn);
$settings = mysql_fetch_assoc($S);
if($settings['stats'] == ‘1′)
$sql = “select * from categories where fatherID = ‘” . $subcategory['id'] . “‘”;
$Results = mysql_query($sql,$myconn) or die(mysql_error());
$subcats = mysql_query($sql,$myconn);
$stats = ‘ (‘.mysql_num_rows($subcats).’) (‘.mysql_num_rows($R).’)';
This will show the number of subcategories and number of links under each category.
Hope you will find it useful. And if you do, then write a review and leave a commment!
Thanks!