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 :)
Printable View
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 should work :)HTML 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>
tyvm :)
+rep
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];
?>
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 :P
What i want is 10 different things to be randomized.
So in each content bit can you putanddQuote:
<a href="http://www.habbo.co.uk/home/NAME">NAME</a>
Thanks :PQuote:
<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
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.
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.
OK
i've done somethin wrong agen tho ;P Im no good at php.
no idea what though ;S
It says its on line 56 which isso im guessing i did something to muck up the image? ;SQuote:
image( $habbo[ $rand ] );
Anywayy.
Can you make it so it shows the image, aligned to the right from the top.
Then say 'Every week we put 10 random Habbos into the Spotlight! One of this weeks featured Habbos is' and then the habbo name bit
Thanks ;P again:rolleyes:
I was actually about to post about using count as opposed to incrementing it, but Mentor pointed it out before I even saw the thread :P
Nice codes :) Good for content use :)