forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: HerrickHouse on February 22, 2006, 11:13:14 pm

Title: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: HerrickHouse on February 22, 2006, 11:13:14 pm
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):
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: Joachim Müller 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
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: HerrickHouse 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.
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: Joachim Müller 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.
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: bsky92 on April 09, 2006, 12:07:32 pm
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 .....
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: bsky92 on April 09, 2006, 12:48:05 pm
Thanks soooooooooooo much, it works perfectly, and it is exactly what I have been looking for  :-X
Title: Re: HACK: Allow direct access to slideshow from Album list page (and others)
Post by: wwwebguru 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!