Author Topic: Second Random Image  (Read 4925 times)

0 Members and 1 Guest are viewing this topic.

Offline Vienix

  • Full Member
  • ***
  • Posts: 144
    • View Profile
    • com.municate.nl
Second Random Image
« on: June 13, 2002, 02:01:02 PM »
Hi,

I would like to have a second random image on the frontpage, and maybey on some other pages as well.

I copied the "random image block" but then I get the same image.

How can I create a second random image ?

thanks...
Thats It !

Offline Konqueror

  • Newbie
  • *
  • Posts: 15
    • View Profile
Second Random Image
« Reply #1 on: June 13, 2002, 03:29:03 PM »
OK, here's my *guess* on how it should work...
In page_header.php replace
Code: [Select]
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);

with
Code: [Select]
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$random_image2 = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
$site_template->register_vars("random_image2", $random_image2);
unset($random_image);
unset($random_image2);


Now copy {if random_image} till {endif random_image} in your templates, paste it where you want it and then change random_image to random_image2 in the second instance.
Nope, I didn't test this, but if you want you can try. (I think it should work) ;)

Offline Vienix

  • Full Member
  • ***
  • Posts: 144
    • View Profile
    • com.municate.nl
Second Random Image
« Reply #2 on: June 13, 2002, 11:09:40 PM »
Quote
Nope, I didn't test this, but if you want you can try. (I think it should work)


I thought so too !, But it didn't... get the same image result
from both functions, with and without a "2".

There is something in the code with "$random_image_cache"
maybe the image gets pulled from cache or something?

I really dont know what I am talking about here, so smiling is allowed :)
Thats It !

Offline Konqueror

  • Newbie
  • *
  • Posts: 15
    • View Profile
Second Random Image
« Reply #3 on: June 13, 2002, 11:24:08 PM »
Yes indeed, I think there's a random image cache... I'll take a quick look at it, maybe I can throw smth. together. :)

Offline anrob

  • Pre-Newbie
  • Posts: 6
    • View Profile
Second Random Image
« Reply #4 on: December 10, 2002, 07:31:37 PM »
Anyone get this to work yet?

This would be great.

Is there a way to define the number of random images on the main page.

That might even be better then messing with the code.


Thanks

Anrob