random image from gallery2

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
hotze
Forum Members
Forum Members
Posts: 28
Joined: Sun May 07, 2006 4:05 pm

random image from gallery2

Post by hotze »

Hi,

I am running cmsms and gallery2 (right now on different domains because cmsms will substitute another cms, therefore the new site has to be build in the background). gallery2 will not be directly embedded within cmsms, but there was a "need" to show the random image offered from gallery2 within cmsms.

short version: *yeah!*

long version:
go and create a custom tag, I named it "g2_random_image" with this content:
-------snip
//display a random image pulled from gallery2
@readfile('http://domain.tld/gallerydir/main.php?g ... _show=name');
---snap
you can play around with "g2_show=name" etc - this show=name hides (!) the filename

now you can insert the random image with {g2_random_image}


I also have put the random image on the left navigation of the site. therefore I created a global content; I named it "g2_random_image" and inserted the tag {g2_random_image}

now I edited the template and added on the right place:
---snip

     
      {global_content name='g2_random_image'}
     
---snap

for now you can see the result here: http://www.lvm.at/index.php?page=impressum
on this page with both within the content and within the left navigation.

hope this helps!

greetings,

martin
heatherfeuer

Re: random image from gallery2

Post by heatherfeuer »

Way cool!  In my spare time, I'm upgrading my personal site to CMSMS.  I have growing grandchildren and I need an easy way to keep the site updated and CMSMS is perfect.  I already use Gallery 1.5, but want to upgrade to Gallery 2 so I can utilize the database.  I was hoping to figure out how to insert random images in the sidebar, but you've done it!

Thanks!
Post Reply

Return to “Tips and Tricks”