Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: layout control  (Read 3903 times)

0 Members and 1 Guest are viewing this topic.

Aakoo

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 1
layout control
« on: February 16, 2007, 11:05:49 pm »

I am not very sure if i am in a right forum. But i think this is a feature request.

Index.php has a layout control that allows coppermine site manager to control the structure of the layout ( main_page_layout var in config table ). I suggest that the same structure should be copied to other  pages too ( at least to thumbnails and displayimage ). I have hacked this for my thumbnails.php script. I include the script here, so that someone with access to cvs can look at it and maybe take the functionality and put in the next version?

Here is the php that actually does the work:

$elements = preg_split("|/|", $CONFIG['thumbnail_page_layout'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($elements as $element) {
   if (preg_match("/(\w+),*(\d+)*/", $element, $matches)){
       if (!isset($matches[2])) { // added to fix notice about undefined index
            $matches[2] = 0;
        }
        $matches = CPGPluginAPI::filter('plugin_block', $matches);
    }
CPGPluginAPI::filter('pre_'.$matches, null);
     if (is_array($matches)) {
           switch ($matches[1]) {
               case 'breadcrumb':
                   CPGPluginAPI::filter('post_breadcrumb',null);
                   if ($breadcrumb) {
                       if (!(strpos($CONFIG['main_page_layout'], "breadcrumb") === false)) {
                            theme_display_breadcrumb($breadcrumb, $cat_data);
                       }
                       theme_display_cat_list($breadcrumb, $cat_data, '');
                   }
               break;
               case 'thumbnails':
                 if (!$valid) {
                     form_albpw();
                 } else {
                     display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);
                 }

               break;
           }
     }
CPGPluginAPI::filter('post_'.$matches, null);
}

I also added  pre_* and post* hooks for each block if someone wants to use 'em in their plugins. I'm not very sure if it is done this way in general in coppermine. The included thumbnails.php is a version from cpg 1.4.9 and i hope that there has not been any bigger changes in the script on version 1.4.10
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.