Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[tut] Random Page Titles
#1
I was interested in doing this a few months ago and found that it was actually much easier then it seems!

Randomising the page titles is just a neat little "Easter egg", if you will" that simply changes the title of the page everytime it is loaded.
an example of this is:
www.bungie.net
where sometimes the title is simply bungie.net and other times it says things such as "xbox live and pizza 24/7" or "so we made this game called halo"

here is the code:
PHP Code:
<?php
site name
[1] = "Cameron's Privates, now with crabs!"
site name [2] = "Cameron's Privates, dont you love them?";
site name[3] = "Cameron's Privates, I've got wood... in my fire!";
site name[4] = "Cameron's Privates";

$random_select rand(14);
echo 
$title[$random_select];
?>

as we can see, the titles you want to add are in the 1st section of the code, and the second section of the code is what automates the changing of titles. you will have to adjust it to the amount of titles you have.

eg. if you have 10 titles your code will look like this (in the 2nd section)
PHP Code:
$random_select rand(110);
echo 
$title[$random_select]; 

instead of:
PHP Code:
$random_select rand(14);
echo 
$title[$random_select]; 

simple isn't it!

By the way, cameronsprivates.com is my proxy. Just incase you were wondering!
Reply


Messages In This Thread
[tut] Random Page Titles - by Extasey - 10-04-2009, 07:09 PM
RE: [tut] Random Page Titles - by MyNameIs940 - 10-04-2009, 08:34 PM
RE: [tut] Random Page Titles - by Viciousness - 10-04-2009, 08:43 PM
RE: [tut] Random Page Titles - by Skawke - 10-04-2009, 08:53 PM
RE: [tut] Random Page Titles - by Extasey - 10-04-2009, 08:56 PM
RE: [tut] Random Page Titles - by Kernel32 - 10-05-2009, 03:06 AM
RE: [tut] Random Page Titles - by GizSho - 10-05-2009, 03:34 AM
RE: [tut] Random Page Titles - by Extasey - 10-05-2009, 03:48 AM
RE: [tut] Random Page Titles - by Pirata Nervo - 10-05-2009, 06:29 AM
RE: [tut] Random Page Titles - by Dr.Viper - 10-08-2009, 08:03 AM
RE: [tut] Random Page Titles - by zone - 11-08-2009, 10:05 AM
RE: [tut] Random Page Titles - by Extasey - 11-08-2009, 07:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [TUT] PHP Password Protected Page PurpleHaze 23 6,969 05-20-2011, 02:56 AM
Last Post: stephen5565
  Random Image PHP Matt G 13 3,790 11-24-2010, 01:21 PM
Last Post: Sam
  Random Signature script Gaijin 8 5,191 01-24-2010, 05:08 PM
Last Post: Gaijin
  Advanced Random Password Generator zone 2 1,222 11-06-2009, 09:16 PM
Last Post: zone

Forum Jump:


Users browsing this thread: 1 Guest(s)