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: A method to hide the date beneath thumbnails - comments welcome  (Read 3113 times)

0 Members and 1 Guest are viewing this topic.

Bar6

  • Contributor
  • Coppermine newbie
  • ***
  • Country: za
  • Offline Offline
  • Posts: 8
    • Geology.Photo

This post is for anyone seeking a method to *not* display the date found beneath each thumbnail. I'm posting this method for peer review and comments because to the best of my knowledge, at the time of this post, there is no convenient way to control display of the upload date found beneath thumbnails. Unfortunately the method described in this post requires that one of the core CPG files be edited. Therefore, this method is *not* recommended for the faint of heart or for anyone unfamiliar with editing PHP.

There are probably any number of ways to manipulate display of the date, once digging into the CPG core coding. I opted for a simple and efficient tweak. The method I describe requires modification of the include/functions.inc.php file, with reference to the following code snippet...

Code: [Select]
        if (in_array('ctime', $must_have)) {
            $caption .= '<span class="thumb_caption">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';

Once locating the code snippet above, I added a new class to the span.thumb_caption element, which encloses the "lastup" date. To that span element, without deleting any existing code, I added the class thumb_caption_hidden as follows...

Code: [Select]
        if (in_array('ctime', $must_have)) { //Bar6 - class "thumb_caption_hidden" added
            $caption .= '<span class="thumb_caption thumb_caption_hidden">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';

Note the space between the two classes. Then, in my gallery's style.css theme file, I added a corresponding .thumb_caption_hidden {display:none;} class, which uses CSS to hide the "lastup" date.

Although I found this tweak to work on my gallery, I wanted a bit more interactive control. There might be instances when I want to display the upload date, without having to edit the theme's style file each time. Hence the code snippet shown below, which toggles display of the date together with display of the uploader name (n.b., a configuration setting).

Code: [Select]
        if (in_array('ctime', $must_have)) { //Bar6 - class "thumb_caption_hidden" added if uploader name not displayed
            if ($CONFIG['display_uploader']) {
                $caption .= '<span class="thumb_caption">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';
            } else {
                $caption .= '<span class="thumb_caption thumb_caption_hidden">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';
            }
        }

Keep in mind that I'll have to reapply this tweak every time CPG is updated.

I'd be interested in reading comments about other methods...? ;)
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.