Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Random quote generator
  
User name:
Password:
Reply:
 

UserPost
Lord Rahl
Posts: 124/792
Thank you both. I'd try to set it up myself, but know nothing of Javascript or PHP, although I would like to learn both. School doesn't offer them, though.
Jesper
Posts: 130/2390
I could be able to set such a contraption up. I already have a login system to change the wootest titles. I'll look into it.
Acmlm
Posts: 366/1173
Hmm ... adding a &____& that shows a random quote would be possible, but you wouldn't be able to customize it

What I'd do is a PHP script that picks a random quote (in text), then outputs an image with that text ... not hard when you know how to use the GD library functions
Lord Rahl
Posts: 100/792
I'll ask Acmlm then, considering I was hoping on using most of my quote list, and I have over one hundred quotes, easy.

EDIT: Or I could just change them by hand, but that kind of defeats what I was hoping of doing.
kiwibonga
Posts: 26/266
something even simpler and dumber:

randimg.php:

<?php

$NUMIMG=put number of images here;

$myrandomnumber = rand(1,$NUMIMG);

switch($myrandomnumber) {

case 1:
header("/images/myrandomimage1.jpg");
break;

case 2:
header("/images/myrandomimage2.jpg");
break;

etc.....

}

?>

it'll just force a redirect to an image automatically.

Oh and since javascript isn't allowed here there's only one way to show random quotes: using images, or asking acmlm to host the random quote script and add a special && tag (right, right)
Wrath
Posts: 11/93
You could also do it using php, but I would only do it this way if youi are going to use a few images because the code will get pretty big if there is alot of images

$rannum=mt_rand(1,10);

if($rannum=='1'){$banner="<img src=imageurl>";}
if($rannum=='2'){$banner="<img src=imageurl>";}
if($rannum=='3'){$banner="<img src=imageurl>";}
if($rannum=='4'){$banner="<img src=imageurl>";}
if($rannum=='5'){$banner="<img src=imageurl>";}
if($rannum=='6'){$banner="<img src=imageurl>";}
if($rannum=='7'){$banner="<img src=imageurl>";}
if($rannum=='8'){$banner="<img src=imageurl>";}
if($rannum=='9'){$banner="<img src=imageurl>";}
if($rannum=='10'){$banner="<img src=imageurl>";}


Edit the coding for your own preferences and use the variable $banner to display the image





Kenny3900
Posts: 8/9
JavaScript can do that already

(Text before)

// Put inside <script>
var theQuotes = new Array(Number of quotes);
theQuotes[0] = "Quote #1";
...
theQuotes[Number of quotes - 1] = "Quote #n";
document.write(theQuotes[Math.round(Math.random() * Number of quotes -.5)]);
// </script>

(Text after)
Lord Rahl
Posts: 93/792
Would you have any idea how to change it so that it would do text instead of pictures?

EDIT: Short of putting my quote list into a collection of pictures, of course.
FreeDOS
Posts: 244/1657
I have one for pulling out random images...

http://mike.gamingvortex.net/images/randimg.phps

Basically:
1. Make new directory.
2. Add images to that directory.
3. Change PHP script to look in that directory (here: $handle = opendir('test'); | and here: $img = fopen("./test/$picture", "r");)

Make sure the extensions are the same as the MIME content type. As long as it's PNG, GIF, and JPG, you're fine.
Lord Rahl
Posts: 88/792
Once on the Soul Angel message board, the head admin, Ogre, had a random picture generator in his layout. It would randomly pick a picture from a collection he had online and place that pic in his layout. Any time the page was refreshed, the pic would change.

Anyway, seeing as that board has been reset since he last used that layout, I was wondering if anyone could help me set up something like that, for quotes, to use on this board?

I would like it for the layout I'm planning on putting together.
Acmlm's Board - I2 Archive - Programming - Random quote generator


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.003 seconds.