Visit SlideShowPro.net  Community Forums
SlideShowPro Support Wiki
  
SlideShowPro Director

Album methods

The Album methods allow you to access albums and content in Director by querying all albums or a single album.

all(options)

Return a list of all albums. This function accepts an options array that can include any of the following parameters.

only_published Allows you to specify if you want to return only published albums or all albums (defaults to true).

only_active Allows you to specify if you want to return active content or all content (defaults to true).

list_only Allows you to only return the list of albums (with no associated content).

only_smart Allows you to return only smart albums in the results (defaults to false).

exclude_smart Allows you to exclude smart albums in the results (defaults to false).

tags Filter the returned albums by tags that have been assigned to the albums in Director. Tags should be a two-member array. The first member is a comma delimited list of tags and the second is whether the albums must have all the tags listed ('all') or only one of the listed tags ('one'). Example:

    # Returns only albums that are assigned the following tags: vacation,summer
    $tags = array('vacation,summer', 'all');
    $albums = $director->album->all(array('tags' => $tags));

    # Returns albums that are assigned any one of the following tags: vacation,summer
    $tags = array('vacation,summer', 'one');
    $albums = $director->album->all(array('tags' => $tags));

Simple example of the all method in use:

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $albums = $director->album->all(array('list_only' => true));

   foreach($albums as $album) {
      echo $album->name . '<br />';
   }

?>

get(album_id, options)

Returns a single album along with its content. This function also accepts an options array that can include any of the following parameters.

only_active Whether to return all album content, or just content that is active (defaults to true).

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $album = $director->album->get(1);
   echo $album->name . '<br /><br />';

   // Loop through album content
   $contents = $album->contents[0];
   foreach($contents as $content) {
      echo $content->src . '<br />';
   }
?>

galleries(album_id, options)

Retrieves the galleries that the provided album is a part of. Only gallery data is returned, no associated albums or their content are returned. This function also accepts an options array that can include any of the following parameters.

exclude An id (or an array of ids) related to any gallery or galleries you wish to exclude from the results.

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $galleries = $director->album->galleries(1, array('exclude' => array(1,10)));
   echo count($galleries);

?>

Page last modified by bdaily on February 17, 2010, at 09:48 PM
© 2011 SlideShowPro. All Rights Reserved.