Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Adding number of images under the title to the album  (Read 10006 times)

0 Members and 1 Guest are viewing this topic.

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 227
  • webstar
Adding number of images under the title to the album
« on: February 04, 2018, 06:01:57 pm »

I am requesting an unique feature to my gallery as I have above 100+ pictures average in each album. Is there any way to add a line or some sort of HTML that picks up the amount of pictures from the album and added into the td.thumbnails space. For instance "Album 1" (title), then another span class that counts the number of pictures in there right next to it or below "Total pictures: xx"
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 227
  • webstar
Re: Adding number of images under the title to the album
« Reply #1 on: February 06, 2018, 07:17:05 am »

Good evening everyone, I spent about three hours to get to this result: https://kristincavallari.net/gallery/index.php?cat=39. The answer to that page is simply in theme.php move around the parameter "{ALB_DESC}".

However, when I want this parameter to show up on the album page with all the images, it does not seem to recognize it and it does not get displayed. https://kristincavallari.net/gallery/thumbnails.php?album=445 See my code from theme.php:

Code: [Select]
/******************************************************************************
** Section <<<$template_fav_thumb_view_title_row>>> - START
******************************************************************************/
// HTML template for title row of the fav thumbnail view (album title + download)
$template_fav_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2> {ALBUM_DESCRIPTION}</td>
                                <td><img src="images/spacer.gif" width="1" border="0" alt="" /></td>
                                <td class="sortorder_cell">
                                        <table cellpadding="0" cellspacing="0">
                                                <tr>
                                                        <td class="sortorder_options"><span class="statlink"><a href="zipdownload.php">{DOWNLOAD_ZIP}</a></span></td>
                                                </tr>
                                                </table>
                                </td>
                        </tr>
                        </table>

EOT;
/******************************************************************************
** Section <<<$template_fav_thumb_view_title_row>>> - END
******************************************************************************/

I need the album title in h1 as is, and then in addition, the album description to show up next to it or preferably below the album title. Please help.
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Adding number of images under the title to the album
« Reply #2 on: February 06, 2018, 02:48:52 pm »

( you do know it shows the number of pics at the bottom of the page, right? )

You'll need to copy the function theme_display_thumbnails into your theme.php from include/themes.inc.php.
In the same way, you'll also need to copy the template $template_thumb_view_title_row.

Then, in the function, find this and make the addition:
Code: [Select]
        $param['{ALBUM_NAME}'] = $album_name;
        $param['{PIC_COUNT}'] = $nbThumb;              // <<--- ADD THIS
        // Plugin Filter: allow plugin to modify or add tags to process
        $param = CPGPluginAPI::filter('theme_thumbnails_title', $param);
        $title = template_eval($template_thumb_view_title_row, $param);

And in the template, add something like this:
Code: [Select]
          <td style="vertical-align:top" class="statlink">
              <h2>{ALBUM_NAME}</h2>
              {PIC_COUNT} Photos     <!-- ADD THIS -->
          </td>
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 227
  • webstar
Re: Re: Adding number of images under the title to the album
« Reply #3 on: February 06, 2018, 04:03:44 pm »

( you do know it shows the number of pics at the bottom of the page, right? )

You'll need to copy the function theme_display_thumbnails into your theme.php from include/themes.inc.php.
In the same way, you'll also need to copy the template $template_thumb_view_title_row.

Then, in the function, find this and make the addition:
Code: [Select]
        $param['{ALBUM_NAME}'] = $album_name;
        $param['{PIC_COUNT}'] = $nbThumb;              // <<--- ADD THIS
        // Plugin Filter: allow plugin to modify or add tags to process
        $param = CPGPluginAPI::filter('theme_thumbnails_title', $param);
        $title = template_eval($template_thumb_view_title_row, $param);

And in the template, add something like this:
Code: [Select]
          <td style="vertical-align:top" class="statlink">
              <h2>{ALBUM_NAME}</h2>
              {PIC_COUNT} Photos     <!-- ADD THIS -->
          </td>

Initially what I needed, is the ALBUM DESCRIPTION to monitor right next to the title. Because in that parameter I use date, which is important to display next to the title. I am aware of the picture count at the bottom but I do want to add it somewhere on top, below the title would be OK as I have a lot of columns down the page.

So I need the {ALBUM_DESCRIPTION} and {PIC_COUNT} to work for me on this page https://kristincavallari.net/gallery/thumbnails.php?album=403
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Adding number of images under the title to the album
« Reply #4 on: February 06, 2018, 05:04:56 pm »

In the same way you can add the album description.

Code: [Select]
$param['{ALBUM_DESC}'] = $CURRENT_ALBUM_DATA['description'];
Then add {ALBUM_DESC} somewhere in the title template.
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 227
  • webstar
Re: Re: Adding number of images under the title to the album
« Reply #5 on: February 06, 2018, 05:22:41 pm »

In the same way you can add the album description.

Code: [Select]
$param['{ALBUM_DESC}'] = $CURRENT_ALBUM_DATA['description'];
Then add {ALBUM_DESC} somewhere in the title template.

Excellent! All thanks to you!
Logged
Pages: [1]   Go Up
 

Page created in 0.055 seconds with 20 queries.