That randomizes content.
So every time you reload the page, a different thing shows in a certain part of the layout.
A bit like the old habbo spotlight thing on the homepage.
Please![]()

That randomizes content.
So every time you reload the page, a different thing shows in a certain part of the layout.
A bit like the old habbo spotlight thing on the homepage.
Please![]()
cake
That should workHTML Code:<script language="JavaScript"> <!-- function random_text() {}; var random_text = new random_text(); var number = 0; random_text[number++] = "Content 1 Goes Here" random_text[number++] = "Content 2 Goes Here" random_text[number++] = "Content 3 Goes Here" random_text[number++] = "Content 4 Goes Here" var random_number = Math.floor(Math.random() * number); document.write(random_text[random_number]); --></script>![]()
Lets set the stage on fire, and hollywood will be jealous.
tyvm
+rep
cake
Doing it via PHP would be better, tbh. (So that the content shows in older browsers).
That's not the best way to do it in PHP, but it still works :pPHP Code:<?php
$content[ 1 ] = "Content piece 1";
$content[ 2 ] = "Content piece 2";
$content[ 3 ] = "Content piece 3";
/* To add a new piece of content just copy the above code and change the '3' to a '4', etc */
$rand = rand( 1, 3 /* Change the "3" to the amount of different content pieces */);
echo $content[$rand];
?>
Last edited by Invent; 27-07-2007 at 05:32 PM.
Thanks to you both, but would you be able to do the full thing for me, which ever way i try it i do it wrong and don't really udnerstand php
What i want is 10 different things to be randomized.
So in each content bit can you putandd<a href="http://www.habbo.co.uk/home/NAME">NAME</a>
Thanks<img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?user=NAME&action=wve&frame=3&direction =4&head_direction=4&gesture=sml&img_format=gif">
Just i keep going wrong-stupid-
+rep again to whoever does it first ;P
cake
To change the current Habbo's just edit the text in the quotes. ( ThePHP Code:<?php
$habbo[1] = "Invent!";
$habbo[2] = "ReviewDude";
$habbo[3] = "Archivist";
$habbo[4] = "iSocks";
$habbo[5] = "Lost_Witness";
$habbo[6] = "HelKat";
$habbo[7] = "UKChaserAl";
$habbo[8] = "Disarno";
$habbo[9] = "RedTiz";
$habbo[10] = "Heidster";
/* No more editing needed! */
$i = "0";
foreach ($habbo as $habbos) {
$i++;
}
function image( $name )
{
echo( '<a href="http://www.habbo.co.uk/home/'. $name .'">'. $name .'</a><br /><img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?user='. $name .'&action=wve&frame=3&direction=4&head_direction=4&gesture=sml&img_format=gif" alt="'. $name.'" /></a>' );
}
$rand = rand( 1, $i );
image( $habbo[ $rand ] );
?>part )PHP Code:"Invent!"
To add another Habbo just add:
So basically you just change the number in the [] to the the number after the last entry.PHP Code:$habbo[11] = "Habbo Name";
P.S: The above code is coded badly, I just made it in 2mins lol.
Last edited by Invent; 27-07-2007 at 10:38 PM.
Php version
PHP Code:<?php
// stuff to poke
$stuff[ 0 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME </a>';
$stuff[ 1 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 1</a>';
$stuff[ 2 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 2</a>';
$stuff[ 3 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 3</a>';
$stuff[ 4 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 4</a>';
$stuff[ 5 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 5</a>';
$stuff[ 6 ] = '<a href="http://www.habbo.co.uk/home/NAME">NAME 6</a>';
$stuff[ 7 ] = '<img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?user=NAME&action=wve&frame=3&direction =4&head_direction=4&gesture=sml&img_format=gif">';
$stuff[ 8 ] = '<img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?user=NAME&action=wve&frame=3&direction =4&head_direction=4&gesture=sml&img_format=gif"> 2';
//Dont poke this, it'll work, just change values above and add/remove from em
$display=rand(0, sizeof($stuff)-1);
echo $stuff[$display];
?>
Lmao, forgot about 'sizeof' and 'count'.
Nah, its just a quicker way of doing all that $i stuff.
Want to hide these adverts? Register an account for free!