Random photo from selected gallery

rated by 0 users
Answered (Verified) This post has 1 verified answer | 6 Replies | 3 Followers

muro1
Top 500 Contributor
84 Posts
Points 1,170
By: muro1
Posted: Sat, Jul 28 2007 8:25 PM

Hi,

I am able to display a random photo from the galleries on my home page using the <CSGallery:GalleryPostData /> tag.

Now, I'd like to choose a specific gallery where the random image should be pulled from. I have looked at the properties of  CSGallery:GalleryPostData but couldn't find any filtering option. Should I use a <QueryOverrides> ? Can someone show me how to do this?

Thank you.

 Jacques 

 
  • Post Points: 20 |

Answered (Verified) Verified Answers

Ben Tiedt
Top 10 Contributor
3,338 Posts
Points 63,065
CS Developers
Answered (Verified) By: Ben Tiedt
Posted: Thu, Aug 9 2007 10:28 AM In reply to

The <CSGallery:GalleryPostData UseRandomPost="true" /> will retrieve a random image based on the context of the control -- if the control is within the context of a Gallery or a Gallery+Album, it will load a random photo from that Gallery or Gallery+Album.

To set the context, you can use a <CSGallery:GalleryList /> control.  For example, to specify a specific gallery from which to load the random photo, you could use:

<CSGallery:GalleryList runat="server">
  <QueryOverrides SectionApplicationKey="[APPLICATION_KEY_OF_PHOTO_GALLERY]" />
  <ItemTemplate>
     <CSGallery:GalleryPostData runat="server" UseRandomPost="true" Property="Subject" />
  </ItemTemplate>
</CSGallery:GalleryList>

Ben Tiedt's Blog

 
Answered (Verified)
  • Post Points: 35 |

All Replies

Ben Tiedt
Top 10 Contributor
3,338 Posts
Points 63,065
CS Developers
Answered (Verified) By: Ben Tiedt
Posted: Thu, Aug 9 2007 10:28 AM In reply to

The <CSGallery:GalleryPostData UseRandomPost="true" /> will retrieve a random image based on the context of the control -- if the control is within the context of a Gallery or a Gallery+Album, it will load a random photo from that Gallery or Gallery+Album.

To set the context, you can use a <CSGallery:GalleryList /> control.  For example, to specify a specific gallery from which to load the random photo, you could use:

<CSGallery:GalleryList runat="server">
  <QueryOverrides SectionApplicationKey="[APPLICATION_KEY_OF_PHOTO_GALLERY]" />
  <ItemTemplate>
     <CSGallery:GalleryPostData runat="server" UseRandomPost="true" Property="Subject" />
  </ItemTemplate>
</CSGallery:GalleryList>

Ben Tiedt's Blog

 
Answered (Verified)
  • Post Points: 35 |
muro1
Top 500 Contributor
84 Posts
Points 1,170
By: muro1
Posted: Sat, Aug 11 2007 3:04 AM In reply to

This is exactly what I was looking for. Thank you Ben. 

 
  • Post Points: 20 |
baotao
Not Ranked
2 Posts
Points 200
By: baotao
Posted: Tue, Aug 14 2007 4:38 AM In reply to

maybe you need auto display:

    <script type="text/javascript">
        //<![CDATA[   
        function timerFunction()
        {
            <%=CSControlUtility.Instance().FindControl(this, "PhotoUpdater").ClientID %>.Reload();
            window.setTimeout('timerFunction();', 10000);
            return false;
        }

        window.setTimeout('timerFunction();', 10000);

        //]]>
    </script> 

 
  • Post Points: 20 |
muro1
Top 500 Contributor
84 Posts
Points 1,170
By: muro1
Posted: Sat, Aug 18 2007 4:04 AM In reply to

baotao:
maybe you need auto display:
 

That's helpful too, thanks, baotao. 

 
  • Post Points: 5 |
amigooo
Not Ranked
3 Posts
Points 30
By: amigooo
Posted: Sun, Dec 30 2007 6:34 AM In reply to

 hi ben - please tell me: where can i find the application key?

 
  • Filed under: |
  • Post Points: 20 |
Genyus
Top 10 Contributor
2,447 Posts
Points 27,685
MVPs
By: Genyus
Posted: Sun, Dec 30 2007 6:41 AM In reply to
Just navigate to your gallery - the application key will be shown in the path, e.g. http://www.mysite.com/photos/[application key]/default.aspx

-- Commerce for Community Server at last! 4-roads.com Gary

 
  • Post Points: 5 |
Page 1 of 1 (7 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com