Change display order of items on viewimage.php Change display order of items on viewimage.php
 

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

Change display order of items on viewimage.php

Started by scottcrew, October 20, 2007, 02:27:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scottcrew

I am wanting to change the order of the stuff displayed on the viewimage page.
Like moving the filmstrip to the top or bottom. Move the comments, etc...
I may even want to change around other pages as well, but I just need to know how to do this...

In phpBB, it was really easy, but Coppermine seems to have a lot of stuff "locked down"...

Any help is appreciated...

Joachim Müller

You move stuff around by editing themes/yourtheme/theme.php. This file may be empty, as only the function and variable definitions that differ from the default behaviour need to be defined in your custom theme. Therefor, you have to copy functions and variables from themes/sample/theme.php into your custom theme (only copy the stuff you want to see changed) and then modify it. As an example, take a look at the theme "classic filmstrip vert", which is identical to the classic theme in every aspect but the orientation of the film strip, which is not aligned horizontally at the bottom of the page, but vertically at the left of the image.

Here's the content of themes/classic_filmstrip_vert/theme.php:<?php

/************************* Coppermine Photo Gallery ************************
Copyright (c) 2003-2005 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
********************************************
Coppermine version: 1.4.3
Theme class_vert_strip upgraded from 1.3 to 1.4
dec 2005
Very small changes by HarryS
vertical filmstrip, at the left of the intermediate picture
**********************************************/

define('THEME_HAS_FILM_STRIP_GRAPHIC'1);

// HTML template for filmstrip display
$template_film_strip = <<<EOT
<tr><td>
        <table width="100%" cellspacing="0" cellpadding="0">
                <tr>
                <td valign="top" style="background-image: url({TILE1});"><img src="{TILE1}" alt="" border="0" /></td>
                <td>
                 {THUMB_STRIP}
                </td>
                <td valign="top" style="background-image: url({TILE2});"><img src="{TILE2}" alt="" border="0" /></td>
                </tr>
        </table>
</td></tr>

<!-- BEGIN thumb_cell -->
                        <table width="100%" cellspacing="0" cellpadding="0">
                        <tr>
                                <td align="center" valign="bottom">
                                <a href="{LINK_TGT}">{THUMB}</a>
                                </td>
                        </tr>
                        </table>
                        {CAPTION}
                        {ADMIN_MENU}
<!-- END thumb_cell -->
<!-- BEGIN empty_cell -->
                <td valign="top" align="center">&nbsp;</td>
<!-- END empty_cell -->

EOT;


// HTML template for intermediate image display - HS: valign
$template_display_media = <<<EOT
                <td align="center" valign="top" class="display_media" height="{CELL_HEIGHT}" style="white-space: nowrap; padding: 0px;">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                               <tr>
                                        <td align="center">
                                                {IMAGE}
                                                {ADMIN_MENU}
                                        </td>
                               </tr>
                        </table>
<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CAPTION}
                                        </center></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
EOT;

// Added to display film_strip

function theme_display_film_strip(&$thumb_list$nbThumb$album_name$aid$cat$pos$sort_options$mode 'thumb')
{
    global 
$CONFIG$THEME_DIR;
    global 
$template_film_strip$lang_film_strip;

    static 
$template '';
    static 
$thumb_cell '';
    static 
$empty_cell '';
    static 
$spacer '';

    if ((!
$template)) {
        
$template $template_film_strip;
        
$thumb_cell template_extract_block($template'thumb_cell');
        
$empty_cell template_extract_block($template'empty_cell');
    }

    
$cat_link is_numeric($aid) ? '' '&cat=' $cat;

    
$thumbcols $CONFIG['thumbcols'];
    
$cell_width ceil(100 $CONFIG['max_film_strip_items']) . '%';

    
$i 0;
    
$thumb_strip '';
    foreach(
$thumb_list as $thumb) {
        
$i++;
        if (
$mode == 'thumb') {
            
$params = array('{CELL_WIDTH}' => $cell_width,
                
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}",
                
'{THUMB}' => $thumb['image'],
                
'{CAPTION}' => '',
                
'{ADMIN_MENU}' => ''
                
);
        } else {
            
$params = array('{CELL_WIDTH}' => $cell_width,
                
'{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                
'{THUMB}' => $thumb['image'],
                
'{CAPTION}' => '',
                
'{ADMIN_MENU}' => ''
                
);
        }
        
$thumb_strip .= template_eval($thumb_cell$params);
    }

    if (
defined('THEME_HAS_FILM_STRIP_GRAPHICS')) {
        
$tile1 $THEME_DIR 'images/tile1.gif';
        
$tile2 $THEME_DIR 'images/tile2.gif';
    } elseif (
defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        
$tile1=$tile2=$THEME_DIR 'images/tile.gif';
    } else {
        
$tile1=$tile2'images/tile.gif';
    }

    
$params = array('{THUMB_STRIP}' => $thumb_strip,
        
'{COLS}' => $i,
        
'{TILE1}' => $tile1,
        
'{TILE2}' => $tile2,
        );

    
ob_start();
    
starttable('');
      echo 
template_eval($template$params);
    
endtable();
    
$film_strip ob_get_contents();
    
ob_end_clean();

    return 
$film_strip;
}

function 
theme_display_image($nav_menu$picture$votes$pic_info$comments$film_strip)
{
    global 
$HTTP_COOKIE_VARS$CONFIG;

    
starttable();
            echo 
$nav_menu;
    
endtable();
    
starttable();
    if (
$CONFIG['display_film_strip'] == 1) {
                echo 
"<tr><td width='200' class='tableb' valign='middle' ><!-- gb before film_strip -->";
                echo 
$film_strip;
                echo 
"</td><!-- gb after film_strip -->";
    }
                echo 
"<!-- gb before picture -->";
    echo 
$picture;
    echo 
"</tr><!-- gb after picture -->";
    
endtable();

    
starttable();
            echo 
$votes;
    
endtable();

    
$picinfo = isset($HTTP_COOKIE_VARS['picinfo']) ? $HTTP_COOKIE_VARS['picinfo'] : ($CONFIG['display_pic_info'] ? 'block' 'none');
    echo 
"<div id=\"picinfo\" style=\"display: $picinfo;\">\n";
    
starttable();
    echo 
$pic_info;
    
endtable();
    echo 
"</div>\n";

    
starttable();
    echo 
$comments;
    
endtable();
}

?>
As you can see, the only thing that differs from the classic theme is the fact that there are definitions for the variables $template_film_strip, $template_display_media and the functions theme_display_film_strip() and theme_display_image() that are different.

This being said, edit themes/yourtheme/theme.php and copy the said variable and function definitions from themes/sample/theme.php into a new line before ?> of themes/yourtheme/theme.php




Quote from: scottcrew on October 20, 2007, 02:27:43 AMIn phpBB, it was really easy, but Coppermine seems to have a lot of stuff "locked down"...
The coppermine themes are not "locked down". There's just another philosophy behind it: we don't want all custom themes to contain redundant definitions of identical stuff, as most themes only differ in certain aspects from the default behaviour. The reason behind this is ease of maintenance: you only have to look into stuff that you actually want to see changed. Additionally, it gets much easier to upgrade coppermine: if something in the default definition changes, you don't have to reflect those changes in your custom theme unless you modified/overrided that particular part that was changed during the upgrade.




In the future, you should always post a link to your coppermine driven gallery when asking for support. And please don't forget the "one question per thread" policy that you agreed to respect when signing up: your question has been very generic, so my answer was generic as well. If you want to know details (e.g. how to accomplish the film strip above the individual pic), start a separate thread for this question (posting a link to your gallery along that new thread and ideally attaching a zipped copy of your custom theme to your posting there) after having searched the forum; I'm pretty sure that this has been explained often already.

Joachim

scottcrew

But my question is still how do I know what order all of these elements that are part of the {GALLERY} token are put together.
What determines where $template_film_strip, $template_display_media, $template_image_rating or the $template_image_comments gets put on the view image page???
These are the things I want to rearrange the order of...

I am new to php so finding my way around is difficult and I wish you had more tokens for controlling the display of items other than just {GALLERY}, then it would be easier to rearrange the info blocks or template blocks a bit easier... This is the way phpBB is and is much easier to maintain and work with...

TIA!!

Joachim Müller

All those tokens in curly brackets that reside in template.html are actually being replaced with content - in this aspect you're right. But there is one exception: the {GALLERY} token isn't actually a placeholder that is being replaced by something, but rather a separator between the pageheader and pagefooter function. What the {GALLERY}-token gets replaced with depends what coppermine page you're on - it's just the logical container for the output generated by the individual PHP code. If you want to accomplish in-deep changes, you have to stop thinking on token replacement level. Think in terms of variables and theme functions instead that are being set or manipulated in theme.php.
Bottom line: there can not be a single recommendation like "always replace X by Y to change the output that ends up in the space that is being represented by {GALLERY} in template.html".
Start individual threads for individual issues - like "how do I move the filmstrip from the bottom to the top".
I'm sorry, that's the design of the app - it can hardly be changed.