Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    there are a bunch of functions to get gallery by id, name, etc... but not one that i've seen either for getting all albums in collection.

    it should be pretty easy though,

    function get_all_albums(){

    $sql = ""Select id from ".TABLE_PREFIX."collections";
    $results = run_query($sql);
    $num_collectons = mysql_num_rows($results);

    //get all collection id's
    for ($x=0;$x<$num_collections;$x++){
    $temp_id = mysql_fetch_row($results);
    $collection_albums[$x]['collection_id'] = $temp_id[0];
    }
    for ($x=0;$x<$num_collections;$x++){
    $sql = "Select * from ".TABLE_PREFIX."albums where parent_id=".$collection_albums[$x]['collection_id'];
    $results = run_query($sql);
    $num_albums = mysql_num_rows($results);

    //get all albums in each collection
    for ($y=0;$y<$num_albums;$y++){
    $temp_album = mysql_fetch_assoc($results);
    $collection_albums[$x][$y] = $temp_album;
    }
    }

    return $collection_albums;

    }

    this is really sql heavy... should be an easier way to do it with group by or order_by or something... or a join or something... i'm not all that good at sql queries... but the function above should return an array of albums for each collection recursively... and if you don't need all album information then you should just pull the id out so you can use the other functions to get what you need (like generate_url() to get the album url using the id only....)