<PREV> and <NEXT> buttons for Albums <PREV> and <NEXT> buttons for Albums
 

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]

Main Menu

<PREV> and <NEXT> buttons for Albums

Started by flak, December 07, 2006, 07:35:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

flak

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]

dereksurfs

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

flak

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!

dereksurfs

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:

$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:
cpg_db_query("SELECT count(*) from {$CONFIG['TABLE_ALBUMS']}");

- Derek