Including latest album elsewhere

I want to include the latest album on a page on root level, i.e. /index.php shows the latest album that actually resides in the folder /zenphoto/whatever. Is there a basic call for that? What must I include?

Comments

  • Rob Member
    `<?php<br />
    define('SERVERPATH', '/Applications/MAMP/htdocs/foto');

    define('WEBPATH', '/foto');

    function getQueriedPhoto() {

    global $_zp_current_image;

    if(db_connect()) {

    $photo_query = query_single_row('SELECT zp_images.filename, zp_images.title, zp_albums.folder FROM zp_images INNER JOIN zp_albums ON zp_images.albumid = zp_albums.id ORDER BY zp_albums.id LIMIT 1');

    $query_image = new Image(new Album(new Gallery(), $photo_query['folder']), $photo_query['filename']);

    $photo_image = $query_image;

    return $photo_image;

    } else {

    return false;

    }

    }

    function getPhotoLinkURL($photo_image) {

    if (zp_conf('mod_rewrite')) {

    return WEBPATH . "/" . urlencode($photo_image->getAlbumName()) . "/" . urlencode($photo_image->name);

    } else {

    return WEBPATH . "/index.php?album=" . urlencode($photo_image->getAlbumName()) . "&image=" . urlencode($photo_image->name);

    }

    }

    $queriedPhoto = getQueriedPhoto();

    $photoLinkURL = getPhotoLinkURL($queriedPhoto);

    ?>`

    Joen provided me with this piece of code, which works well, but doesn't solve my initial problem. I'm wondering how to change this so that it will pull the latest album, not the latest photo. That way I'll be able to link to the album, pull the album name (title, not sanitised folder name) and display the album thumbnail.

    I'm not that great with Objects, so any help will be appreciated.

Sign In or Register to comment.