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: Where do I edit the Gallery-files ?  (Read 8977 times)

0 Members and 1 Guest are viewing this topic.

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Where do I edit the Gallery-files ?
« on: July 07, 2009, 01:57:55 pm »

I'm not talking about the templates, I want to edit {ADMIN_MENU} and {GALLERY} etc...

Thanks !!
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where do I edit the Gallery-files ?
« Reply #2 on: July 08, 2009, 01:40:02 pm »

I'm not talking about the templates
but those placeholder tokens only exist inside templates. Post what you actually want to accomplish.
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #3 on: July 08, 2009, 03:16:19 pm »

Hi, I posted about this before and the thread is still open but went unanswered, it seemed I "was not allowed to edit" these things.

I would like to edit the content of {GALLERY} the contents of the tables and cells of the gallery. Not the template, not the CSS.
More specific ? Say for example I want to re-arrange the icons for info/slideshow/mailto/previous/next etc...
I have edited and changed these before and they worked, but it was so "deep" that I forgot how and where it was...

I'm not going to post any code or upload zips, my site is www_.bom_bel_man._com (remove under_scores).

Thanks for your help..  :)
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #4 on: July 08, 2009, 03:19:47 pm »

but those placeholder tokens only exist inside templates. Post what you actually want to accomplish.
True, but the template only changes the "look" of the tokens. So again, where can one edit the content of these {TOKENS} ? :)
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #5 on: July 08, 2009, 03:37:51 pm »

Heyz, I found most of what I was looking for in include/themes.in.php
I know what I'm doing and what to edit and what not.

I most certainly know that you will advise users not to edit these files... etc... etc...
So for those of you who are not sure what you're doing... don't edit this file...  ;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where do I edit the Gallery-files ?
« Reply #6 on: July 08, 2009, 04:08:55 pm »

Heyz, I found most of what I was looking for in include/themes.in.php
Do not edit that file! Under no circumstances. Instead: edit themes/yourtheme/theme.php as suggested in the docs and in countless threads on this forum...
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #7 on: July 10, 2009, 10:59:04 am »

Like the good man said, don't edit include/themes.in.php
All changes will be lost, as the core updates will overwrite this.
Instead, copy what you want to edit from sample/themes.php to your own theme.php

Still, I can't find where to edit some specific files in {GALLERY}, for example {IMAGE} , {ALB_LINK_PIC} and {THUMB}.
Can that be answered here or am I required to open another thread ?
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #8 on: July 10, 2009, 11:24:47 am »

Post what you actually want to accomplish.
Well, I tried to "move" the ecard_button from the top of the intermediate image to the bottom of the image.
I did this by moving the code
from: // HTML template for the image navigation bar
to: // HTML template for intermediate image display

Here is the code:

Code: [Select]
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->

I know now this does not work, hehe...
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where do I edit the Gallery-files ?
« Reply #9 on: July 12, 2009, 09:44:16 am »

Still, I can't find where to edit some specific files in {GALLERY}, for example {IMAGE} , {ALB_LINK_PIC} and {THUMB}.
Can that be answered here or am I required to open another thread ?
Those items do not represent particular files. They are placeholders within the template system that get populated in various files. Hence it simply isn't applicable to ask in what files they get populated except if you want an answer like "those placeholders are being populated in various files".

Well, I tried to "move" the ecard_button from the top of the intermediate image to the bottom of the image.
Now this is the real question. You should have posted what you actually want to see accomplished in the first place instead of what you posted above. What you're up to do requires you to edit themes/yourtheme/theme.php

You need to copy some variable definitions and functions from the sample theme into your custom theme if they don't already exist there. This being said, search themes/yourtheme/theme.php for
Code: [Select]
$template_display_media =if that section doesn't exist, copy
Code: [Select]
// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2" cellpadding="0" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb" width="100%">
<!-- 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>
        </tr>

EOT;
from themes/sample/theme.php into a new line before
Code: [Select]
?>of the file themes/yourtheme/theme.php
Then add the placeholder section you want to see added: after
Code: [Select]
<!-- END caption -->copy into a new line of it's own
Code: [Select]
<!-- BEGIN custom_bar -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CUSTOM_BAR}
                                        </center></td>
                                </tr>
<!-- END custom_bar -->

Do the identical thing (copy if not exists) for
Code: [Select]
$template_image_rating =: copy
Code: [Select]
// HTML template for the image rating box
$template_image_rating = <<<EOT
<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
        <tr>
                <td colspan="6" class="tableh2_compact"><b>{TITLE}</b> {VOTES}</td>
        </tr>
        <tr>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE0}" title="{RUBBISH}" rel="nofollow"><img src="{LOCATION}images/rating0.gif" border="0" alt="{RUBBISH}" /><br /></a></td>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE1}" title="{POOR}" rel="nofollow"><img src="{LOCATION}images/rating1.gif" border="0" alt="{POOR}" /><br /></a></td>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE2}" title="{FAIR}" rel="nofollow"><img src="{LOCATION}images/rating2.gif" border="0" alt="{FAIR}" /><br /></a></td>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE3}" title="{GOOD}" rel="nofollow"><img src="{LOCATION}images/rating3.gif" border="0" alt="{GOOD}" /><br /></a></td>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE4}" title="{EXCELLENT}" rel="nofollow"><img src="{LOCATION}images/rating4.gif" border="0" alt="{EXCELLENT}" /><br /></a></td>
                <td class="tableb_compact" width="17%" align="center"><a href="{RATE5}" title="{GREAT}" rel="nofollow"><img src="{LOCATION}images/rating5.gif" border="0" alt="{GREAT}" /><br /></a></td>
        </tr>
</table>
EOT;
into your custom theme and comment out the original link to the ecard button by replacing
Code: [Select]
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->
with
Code: [Select]
<!-- BEGIN ecard_button -->
                <!--<td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>-->
<!-- END ecard_button -->

Now let's add the logic behind the adding of the ecards link to the corresponding function: find
Code: [Select]
function theme_html_picture()in your custom theme and edit as suggested below. If that function is not being defined in your custom theme, copy
Code: [Select]
// Displays a picture
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo;

    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';

    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
    }

    if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }else{
     $condition = false;
    }

    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }

    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }

    $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';

    if ($CONFIG['make_intermediate'] && $condition ) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }

    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);

    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);


    if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {

        if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
            $CURRENT_PIC_DATA['pwidth']  = 320; // Default width

            // Set default height; if file is a movie
            if ($mime_content['content']=='movie') {
                $CURRENT_PIC_DATA['pheight'] = 240; // Default height
            }
        }

        $ctrl_offset['mov']=15;
        $ctrl_offset['wmv']=45;
        $ctrl_offset['swf']=0;
        $ctrl_offset['rm']=0;
        $ctrl_offset_default=45;
        $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
        $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
    }

    if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth']+5;  //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
            $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
            $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
            $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
            $pic_html .= "</a>\n";
        } else {
            $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
        }
    } elseif ($mime_content['content']=='document') {
        $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
    } else {
        $autostart = ($CONFIG['media_autostart']) ? ('true'):('false');

        $players['WMP'] = array('id' => 'MediaPlayer',
                                'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
                                'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" ',
                                'mime' => 'type="application/x-mplayer2" ',
                               );
        $players['RMP'] = array('id' => 'RealPlayer',
                                'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
                                'codebase' => '',
                                'mime' => 'type="audio/x-pn-realaudio-plugin" '
                               );
        $players['QT']  = array('id' => 'QuickTime',
                                'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
                                'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
                                'mime' => 'type="video/x-quicktime" '
                               );
        $players['SWF'] = array('id' => 'SWFlash',
                                'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
                                'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
                                'mime' => 'type="application/x-shockwave-flash" '
                               );
        $players['UNK'] = array('id' => 'DefaultPlayer',
                                'clsid' => '',
                                'codebase' => '',
                                'mime' => ''
                               );

        if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
            $user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
        } else {
            $user_player = $mime_content['player'];
        }

                // There isn't a player selected or user wants client-side control
        if (!$user_player) {
            $user_player = 'UNK';
        }

        $player = $players[$user_player];

        $pic_html  = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";
    }

    $CURRENT_PIC_DATA['html'] = $pic_html;
    $CURRENT_PIC_DATA['header'] = '';
    $CURRENT_PIC_DATA['footer'] = '';

    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

    return template_eval($template_display_media, $params);
}
from themes/sample/theme.php into a new line before
Code: [Select]
?>in themes/yourtheme/theme.php.
In the code you pasted in, find
Code: [Select]
    global $lang_display_image_php, $lang_picinfo;and add below it (into a line of it's own)
Code: [Select]
    global $pos;Then find
Code: [Select]
    $pic_title = '';and add beneath it into a line of it's own
Code: [Select]
    if (USER_CAN_SEND_ECARDS) {
        if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
            $location = $THEME_DIR;
        } else {
            $location = '';
        }
        $ecard_tgt = "ecard.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $ecard_title = $lang_img_nav_bar['ecard_title'];
        $custom_bar = '<a href="'.$ecard_tgt.'" class="navmenu_pic" title="'.$ecard_title.'"><img src="'.$location.'images/ecard.gif"  border="0" align="middle" alt="'.$ecard_title.'" /></a>';
    }
Next, find
Code: [Select]
$CURRENT_PIC_DATA['menu'] = html_picture_menu();and add a line above it with this content:
Code: [Select]
    template_extract_block($template_display_media, 'custom_bar');Finally find
Code: [Select]
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),and add below it (into a new line)
Code: [Select]
        '{CUSTOM_BAR}' => $custom_bar,Save your changes and test everything.

In the future, do as suggested per board rules: always post a link to your gallery in your support requests. Additionally, if you want support with themes, zip your custom theme folder and attach the zip to your posting.

Joachim

P.S. As a proof of concept I'm attaching the changes needed for theme.php rolled into one file. Don't use that file if you already have edited your custom theme. Only use that file if you have a vanilla theme.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where do I edit the Gallery-files ?
« Reply #10 on: July 12, 2009, 09:45:24 am »

Moving thread from misc to theming support board
Logged

bbm

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Where do I edit the Gallery-files ?
« Reply #11 on: July 12, 2009, 10:05:42 pm »

Joachim, thanks, you've put a lot of time into the answer, I will modify the script and post the results here.
I hope it will work for me as you described. Once more, thank you very much !
Logged
Pages: [1]   Go Up
 

Page created in 0.032 seconds with 19 queries.