forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: lysbjerg on March 08, 2004, 03:50:56 pm

Title: Album title in slideshows
Post by: lysbjerg on March 08, 2004, 03:50:56 pm
I am a newbie to templates so please help me out here.

I am trying to display the album title when running a slideshow.

Here is what I've done:

In
Code: [Select]
displayimage.php in
Code: [Select]
function slideshow() I've added
Code: [Select]
$CURRENT_ALBUM_DATA as a global variable.

Before the
Code: [Select]
echo template_eval($template_display_picture, $params); line I've added
Code: [Select]
echo '<tr><th>'.$CURRENT_ALBUM_DATA['title'].'</th></tr>'; but
Code: [Select]
$CURRENT_ALBUM_DATA['title'] seems empty...

If I instead add
Code: [Select]
echo '<tr><th>TEST</th></tr>'; the TEST title appears as wanted.

Thank you in advance

Simon
Title: A possible solution
Post by: lysbjerg on March 08, 2004, 04:36:55 pm
OK. Here is what I've done:

In displayimage.php I've added the code

Code: [Select]
else if (isset($HTTP_GET_VARS['slideshow']) && is_numeric($album)) {
    $result = db_query("SELECT title, comments, votes, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$album}' LIMIT 1");
    if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $album), __FILE__, __LINE__);
    $CURRENT_ALBUM_DATA = mysql_fetch_array($result);
}


after

Code: [Select]
// Retrieve data for the current album
if (isset($CURRENT_PIC_DATA)) {
    $result = db_query("SELECT title, comments, votes, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1");
    if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__);
    $CURRENT_ALBUM_DATA = mysql_fetch_array($result);

    if (is_numeric($album)) {
        $cat = - $album;
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
        $cat = - $album;
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
    }
}


Probably not the best solution but it seems to work...