Multiple Catagory Columns Multiple Catagory Columns
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Multiple Catagory Columns

Started by Bacchus72, November 17, 2008, 06:11:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bacchus72

I am looking for a hack to have multiple columns for my columns/albums. Basically, I want to save vertical space, and the present set up takes up too much space.

I have searched the forums, and I have only come across older threads about older release (1.3.x), which of course no longer applies to the new themes/album.

I have lots of categories, and lots of albums, and I want them all to display (actually, I'd like for the categories to be none-clickable, and only the albums be clickable. So the categories would be more like titles). Preferably, their would be 2-3 columns.

I'd really appreciate any help/direction on this.

Best,

Rob

Joachim Müller

The thread http://coppermine-gallery.net/forum/index.php?topic=15400.msg107765#msg107765 on the cpg1.3.x board applies still applies. Here's what I use on my personal page:function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
  // Taken from http://coppermine-gallery.net/forum/index.php?topic=15400.msg107765#msg107765
  global $template_cat_list, $lang_cat_list;

  starttable('100%');

  if (count($cat_data) > 0) {
    $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_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
  $template = template_extract_block($template_cat_list, 'catrow');
  $template_blank = template_extract_block($template_cat_list, 'catrow_blank');

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

  foreach($cat_data as $category) {
    $count++;
    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],
                '{DEBUG}' => ""
      );
      $count=0;
      echo template_eval($template_noabl, $params);
    } else {
      $params = array('{CAT_TITLE}' => $category[0],
                '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1],
                '{CAT_ALBUMS}' => $category['cat_albums'],
                '{ALB_COUNT}' => $category[2],
                '{PIC_COUNT}' => $category[3],
                '{DEBUG}' => ""
      );
      echo template_eval($template, $params);
    }
    if ($count%$columnCount==0) {
      echo "</tr>\n\r <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);
    }
    endtable();

    if (count($cat_data) > 0)
        echo template_extract_block($template_cat_list, 'spacer');
}