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: <PREV> and <NEXT> buttons for Albums  (Read 5372 times)

0 Members and 1 Guest are viewing this topic.

flak

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
<PREV> and <NEXT> buttons for Albums
« on: December 07, 2006, 07:35:28 pm »

Hi folks,

First a big thanks to all that have contributed to creating, updating, hacking, modding Coppermine. Good stuff!!

[begging]
I have a very stripped down, Coppermine v1.4.9 site, using the Project_vii theme.
No categories, 1-3 images in each album.
What I am trying to do is add <PREV> <NEXT> navigation, but only for ALBUMS, and place it at the top of all pages.

I've searched the forum and found two topics that cover what I'm looking for, but can't figure out how to get it working specifically the way I need it.

These two topics seem to cover the basics of what I need to do, and I can get both to work OK, but it not exactly what I'm looking for.
Prev / Next image on tab
http://forum.coppermine-gallery.net/index.php?topic=37312.0

Plugin to view all the page numbers
http://forum.coppermine-gallery.net/index.php?topic=37251.0

If anyone can help with this, I'd really appreciate it.
[/begging]
Logged

dereksurfs

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: <PREV> and <NEXT> buttons for Albums
« Reply #1 on: December 11, 2006, 04:30:14 pm »

Flak,

I have read your Q. a few times and I am not quite sure what you are asking.  You say that you only have 1-3 images per album, but that you want a previous/next for the albums.  Do you mean on the main index.php page and not within each album?

I have used the two links to modify my PREV/NEXT navigation within my albums.  I also added some customization to it.  You can see what I do here:
http://www.lightquestphoto.com/coppermine/thumbnails.php?album=1&page=2

I have PREV/NEXT on top and bottom now for easy user navigation.  I don't know if this is something you are looking for.  Can you tell us what you have tried so far?

- Derek
Logged

flak

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: <PREV> and <NEXT> buttons for Albums
« Reply #2 on: December 13, 2006, 06:38:45 pm »

Thanks for the reply Derek.
Sorry for the confusion. What I am looking to do is create links to Previous Album and Next Album.
I'd like to place those links within Intermediate and Thumbnail views.

Does that make more sense?

Thanks!
Logged

dereksurfs

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: <PREV> and <NEXT> buttons for Albums
« Reply #3 on: December 15, 2006, 08:02:49 pm »

Flak,

This sounds like a functionality that will require custom coding.  I don't know how comfortable with coding you are.  But samples of similar things can go a long way to get you where you want to go.  Here is how I might approach this:

In your local theme.php file
1.  create two variables called $prev_album, $next_album.
2.  Get the current album number.  Possible ways:
  a. Call $_GET[album].  I believe that returns the id.
  b. Parse the URL and retrieve the album number (i.e. http://www.lightquestphoto.com/coppermine/thumbnails.php?album=1)
3. Assign the correct values to these variables.  Then call them inside the code which creates the layout for the thumbnail and album pages.

That is what I did to get the album description and add it to the top of the album.  Here is the code I used:
Code: [Select]
$album_desc = '';

// Get the album info
function get_album_data($aid)
{
    global $CONFIG;
    global $lang_errors;
    global $album_desc;
   
    $result = cpg_db_query("SELECT description from {$CONFIG['TABLE_ALBUMS']} WHERE aid='$aid'");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        $row = mysql_fetch_array($result);       
        $album_desc = $row['description'];
    }        
}

get_album_data($_GET[album]);


// HTML template for title row of the  view (album title + sort options)
$template_thumb_view_title_row = <<<EOT

<table width="98%" cellpadding="0" cellspacing="0" class="gcBorder1Top" >
        <tr cellpadding="3" >
            <td style="width: 80%; vertical-align:top; text-align:left">
                <p class="giDescription">{$album_desc}</p>
            </td>
        </tr>                       
    </table><br />

EOT;

This should get you started.  It is up to try and code the rest of it.  But let us know how it goes after you try and get it going.

Note: To make this really clean you will need to get the total album count so you know where to stop with $next_album.  A db function like I use above can get you the count of albums as well.  Change the SQL to something like this:
Code: [Select]
cpg_db_query("SELECT count(*) from {$CONFIG['TABLE_ALBUMS']}");

- Derek
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 19 queries.