Random Banner for vB 3.6?
Collapse
X
-
Tags: None
-
-
It does, but I am trying to make it with three banners simultaneously.
I mean, How to have three rotating, non repeating-at-same-time banners in the same page?
Something like this:
I've tried putting two more identical plugins (with the same banners) and changing the
PHP Code:$random_banner[$random_number]
PHP Code:$random_banner[$random_number2]
PHP Code:$random_banner[$random_number3]
Thank you in advance.Last edited by Goldoff; Wed 1 Nov '06, 2:17pm.Comment
-
You can modify the code to prevent identical random numbers. For help with this you should post on www.vbulletin.org.Comment
-
EDIT: CORRECTED to provide 3 distinct numbers.
Code:$random_number1 = rand(1, 5); do { $random_number2 = rand(1, 5); } while ($random_number2 == $random_number1); do { $random_number3 = rand(1, 5); } while (($random_number3 == $random_number1) or ($random_number3 == $random_number2));
Last edited by feldon23; Fri 3 Nov '06, 1:24pm.Comment
-
Wow
Hi Feldon,
(oops, and hi Jake too)
Thanks for your help, but...
When I pasted that code replacing the
PHP Code:$random_banner[$random_number]
and the other two, the board just stopped working and I was unable to access the cp nor the board itself: Lots of "Fatal errors"...
Fortunately, I was working with the test one. Re-installing the whole thing.
What I did wrong?
Again, thank you for your timeComment
-
You cannot paste a bunch of PHP code into a template!
My instructions were to add to the Plugin. Then in your template, you can use $random_banner[$random_number1], $random_banner[$random_number2], and $random_banner[$random_number3].
If a Plugin causes problems, you can disable plugins in the /includes/config.php file. No need to reinstall vBulletin.Last edited by feldon23; Fri 3 Nov '06, 6:15am.Comment
-
Sorry, it took me forever to make it working because I forgot to enable the plugin system after re-installing...
Well, the fact is that it is working now... but there are three equal banners each time:
no matter how many times I refresh...
This time I did what you said: added your whole code to the plugin (just one) and put in the template
$random_banner[$random_number1]
$random_banner[$random_number2]
and
$random_banner[$random_number3]
Don't know what went wrong this time...
I do appreciate your patience.Comment
-
Ok, how did I miss that?!
This is the correct code, I promise:
Code:$random_number1 = rand(1, 5); do { $random_number2 = rand(1, 5); } while ($random_number2 == $random_number1); do { $random_number3 = rand(1, 5); } while (($random_number3 == $random_number1) or ($random_number3 == $random_number2));
Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment