If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!I want to create a block of html on my home page that is different each time someone refreshes the page. Something like how ads are displayed is what I want. So maybe just adding something like openads to my site would be best. How would you go about this?
You can do that with a server-side language available on your server for example PHP. It can also be done in javascript provided it's enabled on the client browser (most of the time it is but not always. Also search engines do not have javascript capability and won't see the block).
Do you have PHP or another language like ASP enabled on your server so I could build an example ?
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
Here is one example:
I assume you will keep the blocks of code in external files and have 5 pages numbered 1.html thru 5.html in the same directory (you can adapt the $files variable for your purpose).
The script will pick one file at random and display the contents. That's it.
PHP Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<?php
srand((float) microtime() * 10000000); // randomize seed - not needed starting from PHP 4.2.0 and up
$files = array("1.html", "2.html", "3.html", "4.html", "5.html");
$random_file = array_rand($files); // pick one entry at random
include ($files[$random_file]); // display contents of the selected file
?>
</body>
</html>
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
You can also do it from a text file or MySQL database.
Kate, I am having the same question but the php is not working for me. I am not a php programmer and am not even sure if I am typing in the directories the correct way. And then also, can I just copy the php and place it between a div tag on an html page?
Thanks.
Bookmarks