News:

CPG Release 1.6.29
During HTML5 upload, keep pseudo blank code 200 messages from triggering error condition
added Russian language
correct failure to use theme menu icons in album manager
minor vulnerabilities mitigation

Main Menu

Album title in slideshows

Started by lysbjerg, March 08, 2004, 03:50:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lysbjerg

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 displayimage.php in function slideshow() I've added $CURRENT_ALBUM_DATA as a global variable.

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

If I instead add echo '<tr><th>TEST</th></tr>'; the TEST title appears as wanted.

Thank you in advance

Simon

lysbjerg

OK. Here is what I've done:

In displayimage.php I've added the code

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

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