# Using the gallery extension

**URL:** <https://www.ruby-forum.com/t/using-the-gallery-extension/137915>\
**Category:** Radiant CMS\
**Created:** [May 18, 2008, 7:04am UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915 "2008-05-18T07:04:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [May 18, 2008, 7:04am UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915/1 "2008-05-18T07:04:30Z")

</div>

OK, I guess I must be missing something obvious but I just can’t see  
how it works. I’ve created public/galleries, create a “Test” one, put  
a picture in it and… where is it supposed to appear?  
/galleries/? /galleries/Test? Do I have to create an new Page  
with one of the gallery layouts, probably with a Gallery page type?  
Is it documented somewhere??

Thanks.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [May 20, 2008, 1:00am UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915/2 "2008-05-20T01:00:46Z")

</div>

Hi Ollivier. …some of this you might have already figured out.

Create a new gallery by going to the Admin UI and clicking on the  
“Galleries” tab. Click on the “New Gallery” button and from there  
upload some pics, edit the gallery description, etc. Name the gallery  
“MyPics” for example.

Then go to the “Pages” tab and create a new page, call it “Photos” for  
example, and make sure you select the “Gallery” page type from the  
“Page Type” drop-down selections. In the body of this page, you’ll put  
some html and radiant tags to display pics from your “MyPics” gallery.  
Here’s the code I use for my galleries with some explanations added:

```
  <!-- galleries -->
  <r:gallery:if_galleries>
    <div class="galleries">

```

## I have several galleries, so the next statement loops through each

of them, producing links to the individual

## galleries. You can still do this even with only one gallery.

```
      <r:galleries:each level="current">
        <div class="gallery">
          <r:gallery:if_items>
            <div class="thumb" style="background-image:

```

url(’\<r:gallery:item:thumb width=“120” position=“first” /\>’);"\>  
  
\<r:gallery:name /\>  
   
  
\</r:gallery:if\_items\>

  

## \<r:gallery:link /\>
  

\<r:gallery:description /\>

  

  

  
  
\</r:galleries:each\>  
  
\</r:gallery:if\_galleries\>  
  
\<r:gallery:unless\_galleries\>  
  
\<r:gallery:item:unless\_current\>  
\<r:gallery:if\_items\>  

  

\<r:gallery:description /\>

## This next loop picks up information about each item (ie. photo) in

the gallery and creates thumbnails and links

## to each of the photos. This is what you see when you click on the

gallery link produced above.  
\<r:gallery:items:each\>

  
\<div class=“thumb” style=“background-image:  
url(’\<r:gallery:item:thumb width=“150” /\>’)”\>  
\<a href="\<r:gallery:item:thumb width=“500” /\>"  
rel=“lightbox[\<r:gallery:name /\>]” title="\<r:gallery:item:name /\>"\>  
\<r:gallery:item:name /\>  
  

  

  
  
\</r:gallery:items:each\>  

  
  
\</r:gallery:if\_items\>  
\</r:gallery:item:unless\_current\>  
  

## This next bit is what formats the page for individual photos, with

navigation links to next/previous items.  
\<r:gallery:item:if\_current\>  
\<r:gallery:item:current\>

  

  

  
\<r:gallery:item:if\_prev\>  
«  
prev  
\</r:gallery:item:if\_prev\>  

  

  
\<r:gallery:item:if\_next\>  
next  
»  
\</r:gallery:item:if\_next\>  

  

  

  

  

## \<r:gallery:item:name /\>
  

  
  
\<img src="\<r:gallery:item:thumb width=“450” /\>"  
alt="\<r:gallery:item:name /\>" /\>  
   

  

\<r:gallery:item:description /\>

  

  
\</r:gallery:item:current\>  
\</r:gallery:item:if\_current\>  
  
\</r:gallery:unless\_galleries\>

Most of the above code will be in the sample gallery, if you installed  
it.

Assuming you used my example names, you can go to  
/photos (the Photos gallery-type page) and the  
above code should display your “MyPics” gallery (and any others you  
add later).

Hope this helps.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [May 20, 2008, 1:28am UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915/3 "2008-05-20T01:28:52Z")

</div>

Hey, thank you Marshal,  
I was wondering the same thing too! The documentation around this one  
didn’t  
say much about the displaying portion, but then again, I’m new to the  
CMS  
world.  
-Thembile.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [May 22, 2008, 12:20pm UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915/4 "2008-05-22T12:20:53Z")

</div>

On Thu, May 22, 2008 at 12:15 PM, Ollivier R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Tue, May 20, 2008 at 12:59 AM, Marshal L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi Ollivier. …some of this you might have already figured out.
> 
> Thanks a lot for the explanations. I manage to get running by creating an  
> empty page with the Gallery Cached type and it works fine. It is  
> looking quite good  
> and simple. Any idea on adding comments on individual pictures in the future?
> 
> What I am ultimately looking is a gallery2 clone to be able to ditch  
> php completely… 🙂

I want to add this feature, but unfortunately I’ve no time to work on  
it right now.  
I’ll do it as soon as I can, If you want to contribute you are welcome  
🙂

–  
Andrea F.  
[http://gravityblast.com](http://gravityblast.com) - [http://nimboo.net](http://nimboo.net)

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [May 22, 2008, 12:16pm UTC](https://www.ruby-forum.com/t/using-the-gallery-extension/137915/5 "2008-05-22T12:16:07Z")

</div>

On Tue, May 20, 2008 at 12:59 AM, Marshal L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi Ollivier. …some of this you might have already figured out.

Thanks a lot for the explanations. I manage to get running by creating  
an  
empty page with the Gallery Cached type and it works fine. It is  
looking quite good  
and simple. Any idea on adding comments on individual pictures in the  
future?

What I am ultimately looking is a gallery2 clone to be able to ditch  
php completely… 🙂

Thanks.
