Galleries API

by Shane Bonham, Justin Bodeutsch | Last edited: 3/29/2013

Types of Gallery Pages:

  • gallery list page: list of all galleries
  • gallery detail page: list of all photos in the gallery
  • image detail page: show one photo

display: auto

will be gallery list, gallery detail, or image detail depending on URL

Parameters

show_galleries
TagDescription
__image__ display image in an img tag of one of the photos in the gallery
__title__ display title of gallery
__description__ the description of the gallery
__titlelink__ display the title as a link to the gallery
__postdate__ display the date the gallery was posted
__promoimageurl__ display the url of the promo image, will display random image if none is selected
__promoimageurlthumb__ the thumbnail url of the promo image
__galleryurl__ display the url of gallery
__numberofimages__ number of images in each gallery
Any Custom Fields setup for Galleries will output their API tags
before_show_gallery, after_show_gallery
TagDescription
__title__ The name of the gallery selected
__slug__ The slug of the name of the gallery selected
__numberofimages__ The number of images in each gallery
__description__ The description of the gallery
__pagination__ Splits up the content into smaller chunks
Any Custom Fields setup for Galleries will output their API tags
show_gallery
TagDescription
__image__ display image in an img tag
__imageurl__ display url of the image
__imageurl2__ The second and third image tags point to the same image but will accept different size parameters.
__imageurl3__
__imagefilename__ filename of image
__imagepageurl__ the slug of the image name
__imagelinkurl__ the path of the page the image is linked to if the image is linked
__title__ display title of image
__numberofimages__ number of images in the gallery
__description__ display the description of the image
__galleryslug__ The slug of the name of the gallery selected
show_photo
TagDescription
__image__ display the full image in an img tag
__imageurl__ display the url of the image
__imageurl2__ The second and third image tags point to the same image but will accept different size parameters.
__imageurl3__
__imagelinkurl__ display the url of the page the image is linked to
__gallerytitle__ display the title of the gallery
__title__ ddisplay title of image
__description__ display the description of the image
__prev__ display the previous image in the gallery
__next__ display the next image in the gallery
__prevurl__ display url for the the previous image in the gallery
__nexturl__ display url for the the next image in the gallery
__homeurl__ display the url of the images's gallery

 

display: list

displays a list of galleries

Parameters

find_gallery: gallery-slug

will show the specified gallery

find_group

Only show items assigned to that group. Can find multiple groups with a comma separated list. Uses group slugs.

Example:

"find_group:group-slug1,group-slug2,group-slug3",

       

hide_group

Do not display items assigned to that group. Can find multiple groups with a comma separated list. Uses group slugs.

Example:

"hide_group:group-slug1,group-slug2,group-slug3",

howmany: number

limits the number of galleries displayed if find_gallery is not used.

order: random | recent | creation

will show gallery list from a random selection of galleries in the system; from recently updated galleries; or by creation date, most recent appearing first.

show_galleries
before_show_gallery
show_gallery

display: detail

with 'find_gallery', will display a random image from a gallery. Use 'show:_image__' etc

 

Code Examples

A getContent that uses the auto display mode, shows the image and the title for each of the gallery pages.

getContent(
"gallery",
"show_galleries:__image__ __title__",
"show_gallery:__image__ __title__",
"show_photo:__image__ __title__"
);

A more fully developed gallery getContent that uses the auto display mode.

getContent(
"gallery",
"display:auto",
"order:recent",
"show_galleries:<div class="gallery"><h4>__titlelink__</h4>",
"show_galleries:<p><i>Posted on __postdate format='m/d/y'__</i></p>",
"show_galleries:<p><a href="__galleryurl__"><img src="__promoimageurlthumb__" alt="__title__" width="125" /></a></p>",
"show_galleries:</div>",

"before_show_gallery:<h4>__title__</h4>",
"before_show_gallery:<p>__description__</p>",
"before_show_gallery:<p><a href="..">Gallery Home</a></p>",

"show_gallery:<div class="gallery-thumbnail">",
"show_gallery:<p><a href="__imagepageurl__" title="__title__"><img src="__imageurl__" alt="__title__" width="170" /></a></p></div>",

"show_photo:<h4>__gallerytitle__</h4>",
"show_photo:<p>",
"show_photo:< <a href="__prevurl__">Previous</a> | ",
"show_photo:<a href="__homeurl__">Home</a>",
"show_photo: | <a href="__nexturl__">Next</a> >",
"show_photo:</p>",
"show_photo:<h5>__title__</h5>",
"show_photo:<p><img src="__imageurl__" alt="__title__" /></p>",
"show_photo:<p>__description__</p>"
);

mcms_page_gallery.php (2KB, php)

Monklet:


tag="gallery"
display="list"
find_gallery="home-communities"
show_gallery="__image__"