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: HACK: Allow direct access to slideshow from Album list page (and others)  (Read 12531 times)

0 Members and 1 Guest are viewing this topic.

HerrickHouse

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

New to Coppermine.  Love it.

Not a PHP or HTML programmer, but thought I'd take a crack at something that was bothering me: allowing the user to quickly get to a slideshow.  Currently the user has to select a category, then an album, then a picture, then they can view a slideshow.  I added the slideshow icon to the album list and album pages so the user can go directly to a slideshow of the album.  Feel free to make it look nicer!

Apply the attached patch to include/themes.inc.php (version 1.4.3):
« Last Edit: February 23, 2006, 08:41:11 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: HACK: Allow direct access to slideshow from Album list page (and others)
« Reply #1 on: February 23, 2006, 08:43:20 am »

thanks for the contrib. However, only a small minority of users will be able to use a diff. I suggest coming up with detailed instructions instead (find foo and replace with bar).

Cheers

Joachim
Logged

HerrickHouse

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: HACK: Allow direct access to slideshow from Album list page (and others)
« Reply #2 on: February 23, 2006, 03:55:06 pm »

OK, here is the step-by-step method.

Basic idea is simply to add the appropriately themed slideshow icon with a link to the slideshow.  To do this, the HTML templates need to be modified and because the added HTML has 'variables' (i.e. {SLIDESHOW_TGT}), the appropriate values have to be set before being passed to template_eval().  A side effect is that the global variables $lang_img_nav_bar and $THEME_DIR are now used in functions where they weren't before.

All modifications are in include/themes.inc.php (version 1.4.3).

Around line 291 (when assigning to $template_album_list), find:
Code: [Select]
<span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>
Add the following after the above line:
Code: [Select]
<a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0" align="top" alt="{SLIDESHOW_TITLE}" /></a>

Around line 410 (when assigning to $template_album_list_cat), find:
Code: [Select]
<span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>
Add the following after the above line:
Code: [Select]
<a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0" align="top" alt="{SLIDESHOW_TITLE}" /></a>

Around line 502 (when assigning to $template_thumb_view_title_row), find:
Code: [Select]
<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
Replace it with:
Code: [Select]
<td width="100%" class="statlink"><h2>{ALBUM_NAME} <a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0" align="top" alt="{SLIDESHOW_TITLE}" /></a></h2></td>

Around line 1548 (in function theme_display_album_list):
Code: [Select]
global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list, $lang_album_list;
Replace with:
Code: [Select]
global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list, $lang_album_list, $lang_img_nav_bar, $THEME_DIR;
Still in function theme_display_album_list around line 1596, add these to the assignment of array to params:
Code: [Select]
                '{SLIDESHOW_TGT}' => "displayimage.php?album={$album['aid']}&amp;pos=1&amp;slideshow=".$CONFIG['slideshow_interval'],
                '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
                '{LOCATION}' => (defined('THEME_HAS_NAVBAR_GRAPHICS') ? $THEME_DIR : ''),

In function theme_display_album_list_cat around line 1632, find:
Code: [Select]
global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;
Replace with:
Code: [Select]
global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list, $lang_img_nav_bar, $THEME_DIR;
Then add the following lines around 1682 (at the end of the assignment of array to params):
Code: [Select]
                '{SLIDESHOW_TGT}' => "displayimage.php?album={$album['aid']}&amp;pos=1&amp;slideshow=".$CONFIG['slideshow_interval'],
                '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
                '{LOCATION}' => (defined('THEME_HAS_NAVBAR_GRAPHICS') ? $THEME_DIR : ''),

One last function, theme_display_thumbnails around line 1718, find:
Code: [Select]
     global $CONFIG;
     global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;
Replace with:
Code: [Select]
    global $CONFIG, $THEME_DIR;
    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_img_nav_bar;
Add the following lines after 1775 (end of assign of array to params):
Code: [Select]
            '{SLIDESHOW_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pid={$thumb_list[1]['pid']}&amp;slideshow=".$CONFIG['slideshow_interval'],
            '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
            '{LOCATION}' => (defined('THEME_HAS_NAVBAR_GRAPHICS') ? $THEME_DIR : ''),

And you're done!

I'm not an HTML/CSS person, so if there are better placements for the icon, please feel free to enhance.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: HACK: Allow direct access to slideshow from Album list page (and others)
« Reply #3 on: February 24, 2006, 06:56:19 pm »

Good work. Suggestion: don't edit include/themes.inc.php (you never should), but edit themes/yourtheme/theme.php instead.
Logged

bsky92

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://www.jag-en-ligne.com

I have been looking for something like that for weeks, thanks

no I'll try to apply that on my site

Gaugau, you mean we should edit the theme.php in our own theme? Problem is I don't find the elements to edit in my theme.php .....
Logged

bsky92

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://www.jag-en-ligne.com

Thanks soooooooooooo much, it works perfectly, and it is exactly what I have been looking for  :-X
Logged

wwwebguru

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: HACK: Allow direct access to slideshow from Album list page (and others)
« Reply #6 on: January 10, 2008, 07:16:54 am »

This thing works great on my Album List page but doesn't show on the thumbnails page withing each Album. Any ideas??

Thanks in Advance!
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.