DNforum.com - Domain Sales, Domain Forum, Domain Appraisals
 
Register Now! Welcome to Dnforum.com You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast and simple so please, join our community today! If you have any problems with the registration process or your account login, please contact us.
Go Back   DNForum - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars > Content Development > Website Development and Design Discussion > Coding/Programming/Languages
Reply
 
LinkBack Thread Tools Display Modes
Old 11-27-2007, 02:15 AM   #1 (permalink)
Platinum Lifetime Member
 
Last Online: 02-19-2008 03:16 PM
iTrader: (5)
Join Date: Dec 2006
Posts: 206
DNF$: 260
Location: Virginia
Country:


Random html to appear?

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?
twells22 is offline   Reply With Quote
Old 11-27-2007, 08:29 AM   #2 (permalink)
Cyberspace warrior
 
sdsinc's Avatar
 
Name: Kate
Last Online: 07-02-2008 05:14 AM
iTrader: (25)
Join Date: Jul 2005
Posts: 2,695
DNF$: 10,137
Location: Wonderland
Country:


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 ?
__________________

ShopNames.com - Quality domain names at discount rates

PM me for a SedoPro endorsement code
sdsinc is offline   Reply With Quote
Old 11-27-2007, 11:29 AM   #3 (permalink)
Platinum Lifetime Member
 
Last Online: 02-19-2008 03:16 PM
iTrader: (5)
Join Date: Dec 2006
Posts: 206
DNF$: 260
Location: Virginia
Country:


I have php, it's godaddy's linux hosting.
twells22 is offline   Reply With Quote
Old 11-27-2007, 03:07 PM   #4 (permalink)
Cyberspace warrior
 
sdsinc's Avatar
 
Name: Kate
Last Online: 07-02-2008 05:14 AM
iTrader: (25)
Join Date: Jul 2005
Posts: 2,695
DNF$: 10,137
Location: Wonderland
Country:


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>
__________________

ShopNames.com - Quality domain names at discount rates

PM me for a SedoPro endorsement code
sdsinc is offline   Reply With Quote
Old 11-27-2007, 03:36 PM   #5 (permalink)
jdk
 
jdk's Avatar
 
Name: Doug
Last Online: Yesterday 09:16 PM
iTrader: (151)
Join Date: Jul 2004
Posts: 6,102
DNF$: 69,739
Location: South Florida
Country:


You can also do it from a text file or MySQL database.
jdk is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 05:20 AM.
Copyright @2001-2008 DNForum.com

Learn Domains
Promote Domains
Research Domains
Buy Domains
Resell Domains
Park Domains
Sell Domains
Build Domains
Host Domains
Trademark Domains
Domain Domains
manage Domains
Appraise Domains