A big part of my role on PhotoShelter’s client services team is helping our clients make customizations to their sites. This can range from demonstrating how to use our built-in customization tools, to manually tweaking parts of their sites with CSS or HTML. I was recently tapped to assist with a special project. The goal was to create a special menu on a manually-customized site that would automatically populate with the client’s top-level listed collections. Collections, for those unfamiliar with PhotoShelter terminology, are basically groups of photo galleries (similar to folders).
The client in question was NYCity Photo Wire. It’s a nifty photo wire (stream of news images) run by CUNY’s graduate school of journalism. Here’s the end result.
PhotoShelter’s API is well-suited to this task. Since v3 of the API is still being wrapped up, I decided to stick with v2. The API is able to provide a list of all the top level “listed” galleries and collections. I used a for loop to work through the response, and an if statement to make sure I was only seeing the collections, and not galleries.
Each time it finds a collection, it uses jQuery to append a list item to the new navigation menu. The list item consists of the name of the collection, which links to it. Easy as pie!