<?php
if ( $cats['catcount'] > 0 ) {

echo<<<PPPRINT
<!-- BEGIN TEMPLATE: categories.tmpl -->
$ppopen
            <tr>
PPPRINT;

if ( $Globals['indexavatars'] == "yes" ) {
echo<<<PPPRINT
            <td align="left" class="{$Style['menubar']}" width="5%">
                <span class="{$Style['small']}">&nbsp;</span>
            </td>
PPPRINT;
}

echo<<<PPPRINT
            <td align="left" class="{$Style['menubar']}" width="80%">
                <span class="{$Style['small']}"><b>{$Globals['pp_lang']['category']}</b></span>
            </td>
            <td align="center" class="{$Style['menubar']}" width="125">
                <span class="{$Style['small']}"><b>{$Globals['pp_lang']['photos']}</b></span>
            </td>
PPPRINT;

if ( $Globals['allowpost'] == "yes" ) {
echo<<<PPPRINT
            <td align="center" class="{$Style['menubar']}" width="125">
                <span class="{$Style['small']}"><b>{$Globals['pp_lang']['comments']}</b></span>
            </td>
PPPRINT;

    if ( $Globals['showcoms'] == "yes" ) {
echo<<<PPPRINT
            <td align="center" class="{$Style['menubar']}" nowrap="nowrap">
                <span class="{$Style['small']}"><b>{$Globals['pp_lang']['lastcomment']}</b></span>
            </td>
PPPRINT;
    }
}

if ( $Globals['showlast'] == "yes" ) {
echo<<<PPPRINT
            <!--14806-->
            <td align="center" class="{$Style['menubar']}" nowrap="nowrap">
                <span class="{$Style['small']}"><b>{$Globals['pp_lang']['lastphoto']}</b></span>
            </td>
PPPRINT;
}

echo<<<PPPRINT
            </tr>
PPPRINT;


for ( $x=0; $x < $cats['catcount']; $x++ ) {
if ( $cats['dodetails'][$x] == 1 ) {
    if ($cats['catthumbs'][$x] == "yes") {
echo<<<PPPRINT
            <tr>
PPPRINT;

if ( $Globals['indexavatars'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['catcolumn']}" align="center" width="5%">
                {$cats['avatar'][$x]}
            </td>
PPPRINT;
}

echo<<<PPPRINT
            <td class="{$Style['catcolumn']}" width="45%" align="left">
                <table width="100%" border="0">
                    <tr>


PPPRINT;

        if ( $cats['indent'][$x] > 0 ) {
echo<<<PPPRINT
                    <td width="{$cats['indent'][$x]}">
                        &nbsp;
                    </td>
PPPRINT;
        }

echo<<<PPPRINT
                    <td class="{$Style['catcolumn']}">
                        <span class="{$Style['small']}"><b>{$cats['catlink'][$x]}</b>&nbsp;{$cats['catonline'][$x]}{$cats['catdescript'][$x]}</span>
                    </td>
                    </tr>
                </table>
            </td>
PPPRINT;

if ( $Globals['showlast'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['photocol']}" align="center">
                {$cats['numphotos'][$x]}
            </td>
PPPRINT;
}
else {
echo<<<PPPRINT
            <td class="{$Style['photocol']}" align="right">
                {$cats['numphotos'][$x]} {$cats['lpholink'][$x]}
            </td>
PPPRINT;
}

        if ( $Globals['allowpost'] == "yes" ) {
            if ( $Globals['showcoms'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['commentscol']}" align="center">
                {$cats['numposts'][$x]}
            </td>
PPPRINT;
            }
            else {
echo<<<PPPRINT
            <td class="{$Style['commentscol']}" align="right" nowrap="nowrap">
                {$cats['numposts'][$x]} {$cats['lpostlink'][$x]}
            </td>
PPPRINT;
            }

            if ( $Globals['showcoms'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['lastcommcol']}">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                    <td class="{$Style['lastcommcol']}" align="left" nowrap="nowrap">
                        <span class="{$Style['small']}">{$cats['lcprint'][$x]}<br />
                        {$cats['lastposttext'][$x]}</span>
                    </td>
                    <td class="{$Style['lastcommcol']}" align="right">
                        {$cats['lpostlink'][$x]}
                    </td>
                    </tr>
                </table>
            </td>
PPPRINT;
            }
        } //allowpost

        if ( $Globals['showlast'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['lastphocol']}">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                    <td class="{$Style['lastphocol']}" align="left" nowrap="nowrap">
                        <span class="{$Style['small']}">{$cats['lpprint'][$x]}<br />{$cats['lastphotext'][$x]}</span>
                    </td>
                    <td class="{$Style['lastphocol']}" align="right">
                        {$cats['lpholink'][$x]}
                    </td>
                    </tr>
                </table>
            </td>
PPPRINT;
        }
echo<<<PPPRINT
            </tr>
PPPRINT;
    } // catthumbs
else {
echo<<<PPPRINT
<tr>
PPPRINT;

if ( $Globals['indexavatars'] == "yes" ) {
echo<<<PPPRINT
        <td class="{$Style['catcolumn']}" align="center" width="5%">
            {$cats['avatar'][$x]}
        </td>
PPPRINT;
}

echo<<<PPPRINT
        <td width="45%" class="{$Style['tdnothumbs']}" align="left">
                <table width="100%" border="0">
                    <tr>
PPPRINT;

        if ( $cats['indent'][$x] > 0 ) {
echo<<<PPPRINT
                    <td class="{$Style['tdnothumbs']}" width="{$cats['indent'][$x]}">
                        &nbsp;
                    </td>
PPPRINT;
        }  // indent

echo<<<PPPRINT
                    <td>
                        <b>{$cats['catlink'][$x]}</b>{$cats['catdescript'][$x]}
                    </td>
                    </tr>
                </table>
            </td>
            <td class="{$Style['photocol']}" align="center">
                {$cats['numphotos'][$x]}
            </td>
PPPRINT;

        if ( $Globals['allowpost'] == "yes" ) {
            if ( $Globals['showcoms'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['commentscol']}" align="center">
                {$cats['numposts'][$x]}
            </td>
PPPRINT;
            }
            else {
echo<<<PPPRINT
            <td class="{$Style['commentscol']}" align="right" nowrap="nowrap">
                {$cats['numposts'][$x]}</span> {$cats['lpostlink'][$x]}
            </td>
PPPRINT;
            }

            if ( $Globals['showcoms'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['lastcommcol']}">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                    <td class="{$Style['lastcommcol']}" align="left" nowrap="nowrap">
                        <span class="{$Style['small']}">{$cats['lcprint'][$x]}<br />
                        {$cats['lastposttext'][$x]}</span>
                    </td>
                    <td class="{$Style['lastcommcol']}" align="right">
                        {$cats['lpostlink'][$x]}
                    </td>
                    </tr>
                </table>
            </td>
PPPRINT;
            }
        } //allowpost

        if ( $Globals['showlast'] == "yes" ) {
echo<<<PPPRINT
            <td class="{$Style['lastphocol']}">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                    <td class="{$Style['lastphocol']}" align="left">
                        <span class="{$Style['small']}">{$cats['lpprint'][$x]}<br />{$cats['lastphotext'][$x]}</span>
                    </td>
                    <td class="{$Style['lastphocol']}" align="right">
                        {$cats['lpholink'][$x]}
                    </td>
                    </tr>
                </table>
            </td>
PPPRINT;
        }
echo<<<PPPRINT
            </tr>
PPPRINT;
    }
}
else {

echo<<<PPPRINT
            <tr>
            <td width="100%" colspan="6" class="{$Style['menubar']}" align="left">
                <table width="100%" border="0">
                    <tr>
PPPRINT;

        if ( $cats['indent'][$x] > 0 ) {

echo<<<PPPRINT
                    <td class="{$Style['menubarnb']}" width="{$cats['indent'][$x]}">
                        &nbsp;
                    </td>
PPPRINT;

        }

echo<<<PPPRINT
                    <td class="{$Style['menubarnb']}" align="left">
                        <b>{$cats['catlink'][$x]}</b></span>{$cats['catdescript'][$x]}
                    </td>
                    <td align="right">{$cats['catexpand'][$x]}</td>
                    </tr>
                </table>
            </td>
            </tr>
PPPRINT;

    }
}

echo<<<PPPRINT
$ppclose
<br />
<!-- END TEMPLATE: categories.tmpl -->
PPPRINT;

}
?>
