Location: PHPKode > projects > Maian Gallery > maian_gallery/admin/data_files/image_management/categories.php
<?php

/*++++++++++++++++++++++++++++++++++++++++

  Script: Maian Gallery v2.0
  Written by: David Ian Bennett
  E-Mail: hide@address.com
  Website: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++
  
  This File: categories.php
  Description: Show Image Categories

  ++++++++++++++++++++++++++++++++++++++++*/

// Make sure that this file is being called from parent file
if (!defined('INCLUDE_FILES')) {
  accessDenied($msg_script18,$msg_script19);
  exit;
}

$q_cats = mysql_query("SELECT * FROM ".$database['prefix']."categories 
                       WHERE parent = '1'
                       ORDER BY catname
                       ") or die(mysql_error());

?>
<div align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="1" style="border: 2px solid #083253">
<tr>
    <td align="left" class="msgBox">&raquo; <b><?php echo $msg_adminmenu7; ?></b><br><br><?php echo $msg_manage; ?></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="100%" class="menutable">
<tr>
    <td align="left" class="leftPad">&raquo; <b><?php echo strtoupper($msg_manage9); ?></b> (<?php echo rowCount('categories'); ?>)</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" style="border: 2px solid #083253">
<?php

if (mysql_num_rows($q_cats)>0)
{
  while ($CATS = mysql_fetch_object($q_cats))
  {
    // Get single image..
    $q_img = mysql_query("SELECT * FROM ".$database['prefix']."images 
                          WHERE cat = '{$CATS->id}'
                          ORDER BY rand()
                          LIMIT 1") or die(mysql_error());
    $IMG = mysql_fetch_object($q_img);
  ?>
  <tr>
    <td align="center" class="msgBox">
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" width="15%" class="tdHeight"><img src="<?php echo (mysql_num_rows($q_img)>0 ? $SETTINGS->folder.'/galleries/'.$SETTINGS->folder_name.'/'.$CATS->folder.'/'.$IMG->thumbpath : 'images/no_image.gif'); ?>" alt="<?php echo cleanData($CATS->catname); ?>" height="<?php echo ADD_IMG_HGHT; ?>" width="<?php echo ADD_IMG_WDTH; ?>" class="image_pad" title="<?php echo cleanData($CATS->catname); ?>"></td>
      <td align="left" width="80%" class="tdHeight"><a href="index.php?cmd=cat_images&amp;cat=<?php echo $CATS->id; ?>" title="<?php echo cleanData($CATS->catname); ?>"><b><?php echo cleanData($CATS->catname); ?></b></a> (<?php echo getCategoryImageCount($CATS->id); ?>)<br><br>
      <?php
      
      $q_child = mysql_query("SELECT * FROM ".$database['prefix']."categories 
                              WHERE child = '{$CATS->id}'
                              ORDER BY catname
                              ") or die(mysql_error());
                             
      while ($CHILDREN = mysql_fetch_object($q_child))
      {
      ?>
      <a href="index.php?cmd=cat_images&amp;cat=<?php echo $CHILDREN->id; ?>" title="<?php echo cleanData($CHILDREN->catname); ?>"><?php echo cleanData($CHILDREN->catname); ?></a> (<?php echo getCategoryImageCount($CHILDREN->id); ?>)<?php echo (++$count===mysql_num_rows($q_child) ? '' : ', '); ?>
      <?php
      }                       
      
      $count = 0;
      
      ?>
      </td>
    </tr>  
    </table>
    </td>
  </tr>
  <?php
  }
}
else
{

?>
<tr>
    <td align="center" class="msgBox">[ <?php echo $msg_cats4; ?> ]</td>
</tr>
<?php
}
?>
</table>
<?php
// page numbers..
if (rowCount('categories')>0) {
  echo admin_page_numbers(rowCount('categories',' WHERE parent=\'1\''),$limit,$page);
}
?>
</div>
Return current item: Maian Gallery