Need help modifying 2 column category layout. Need help modifying 2 column category layout.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Need help modifying 2 column category layout.

Started by tenacjed, January 14, 2014, 08:01:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tenacjed

Gallery: www.waggonerphotography.com/gallery2
Currently running 1.5.26, utilizing the mod located here for 2 column category layout:   http://forum.coppermine-gallery.net/index.php/topic,70393.msg344642.html#msg344642

I really like this layout as it makes my gallery main page not as long!  However it can be confusing to look at and know where sub categories fall.  The way I have my parent/child categories setup, I know how to make it look better,  but do not know how to implement.

So my question is... is it possible to have any category that does not contain an album be in its own row within the 2 column category listing that is currently running.  Looking at my main gallery listing, I am looking for this:

Trips
2013
Pantanal, Brazil                    Michigan
2012
Utah                                    East Coast
Arizona                                Michigan
Puerto Rico
2011
Florida                                 Europe
2010
Alaska
2009
Yellowstone National Park      Arizona
Michigan
2008
Michigan                               Grand Teton National Park
Yellowstone National Park   
2007
Kenya, Africa
What a long... strange trip it's been!!!

tenacjed

I think I figured it out!  At least I hope so, initial testing looks good though.  Full code is as follows:


/******************************************************************************
** Section <<<$template_cat_list>>> - START
******************************************************************************/
// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="40%" align="left">{CATEGORY}</td>
                <td class="tableh1" width="5%" align="center">{ALBUMS}</td>
                <td class="tableh1" width="5%" align="center">{PICTURES}</td>
                <td class="tableh1" width="40%" align="left">{CATEGORY}</td>
                <td class="tableh1" width="5%" align="center">{ALBUMS}</td>
                <td class="tableh1" width="5%" align="center">{PICTURES}</td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
                <td class="catrow_noalb" colspan="3"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="6" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
/******************************************************************************
** Section <<<$template_cat_list>>> - END
******************************************************************************/


/******************************************************************************
** Section <<<theme_display_cat_list>>> - START
******************************************************************************/
function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
    global $template_cat_list, $lang_cat_list;
    if (count($cat_data) > 0) {
        starttable('100%');
        $template = template_extract_block($template_cat_list, 'header');
        $params = array(
                '{CATEGORY}' => $lang_cat_list['category'],
                '{ALBUMS}' => $lang_cat_list['albums'],
                '{PICTURES}' => $lang_cat_list['pictures'],
        );
        echo template_eval($template, $params);
    }

    $template_noalb = template_extract_block($template_cat_list, 'catrow_noalb');
    $template = template_extract_block($template_cat_list, 'catrow');

    $count=0;
    $columnCount=2;
    echo "<tr>"; 

    foreach($cat_data as $category) {
        $count++;
        if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
        if (count($category) == 3) {
            if ($count%$columnCount==0) {
                $params = array('{DEBUG}' => "");
                echo template_eval($template_blank, $params);
            }
            $params = array(
                    '{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                    '{CAT_DESC}' => $category[1],
            );
            /******* START - Display empty category as single row in 2 column layout **/
            echo "</tr> <tr>";
            echo template_eval($template_noalb, $params);   /**Original Code**/
            echo "</tr> <tr>";
            $count=0;
    /******* END - Display empty category as single row in 2 column layout **/
        } elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
            $params = array(
                    '{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                    '{CAT_DESC}' => $category[1],
                    '{CAT_ALBUMS}' => $category['cat_albums'],
                    '{ALB_COUNT}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            echo template_eval($template, $params);
        } else {
            $params = array(
                    '{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                    '{CAT_DESC}' => $category[1],
                    '{CAT_ALBUMS}' => '',
                    '{ALB_COUNT}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            echo template_eval($template, $params);
        }
        if ($count%$columnCount==0) {
            echo "</tr> <tr>";
        }
    }

    echo "</tr>";

    if ($statistics && count($cat_data) > 0) {
        $template = template_extract_block($template_cat_list, 'footer');
        $params = array('{STATISTICS}' => $statistics);
        echo template_eval($template, $params);
    }


    if (count($cat_data) > 0)
          endtable();
        echo template_extract_block($template_cat_list, 'spacer');
}
/******************************************************************************
** Section <<<theme_display_cat_list>>> - END
******************************************************************************/


The area of change was from the section that was in Section <<<theme_display_cat_list>>> within the foreach loop:
$params = array(
                    '{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                    '{CAT_DESC}' => $category[1],
            );
            echo template_eval($template_noalb, $params);


I added the following code around the echo:

            echo "</tr> <tr>";
            echo template_eval($template_noalb, $params);   /**Original Code**/
            echo "</tr> <tr>";
            $count=0;
What a long... strange trip it's been!!!