HACK: Allow direct access to slideshow from Album list page (and others) HACK: Allow direct access to slideshow from Album list page (and others)
 

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

Main Menu

HACK: Allow direct access to slideshow from Album list page (and others)

Started by HerrickHouse, February 22, 2006, 11:13:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HerrickHouse

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):

Joachim Müller

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

HerrickHouse

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:

<span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>

Add the following after the above line:

<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:

<span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>

Add the following after the above line:

<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:

<td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>

Replace it with:

<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):

global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list, $lang_album_list;

Replace with:

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:

                '{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:

global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;

Replace with:

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):
                '{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:

     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:

    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):

            '{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.

Joachim Müller

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

bsky92

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 .....

bsky92

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

wwwebguru

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!