|
|
|
|
|
|
|
![]() |
#1 |
Just because I don't care doesn't mean I don't understand!
Join Date: Feb 2004
Posts: 92
|
Hoping to find a random link script
Hello gang,
I am looking for a little script which will display random links. I am using the following java but it is to cluttered to use with anything over 3-4 links listed. Plus the java has to be used every place you want the link displayed on a page. Very messy indeed. Not real fond of java anyway. I am guessing there is a nice php script around somwhere but I haven't found one. I don't have much experience with php, but will hopefully be able to figure it out and install it ok. Also, if the script can be adjusted to display a picture of the day (not random but from a numbered list for example) that would be great. You can message me here or through email at: webmaster(at)dunkinsworld.com I really appreciate any help with this one. Thanks again, Dunkin <script language="JavaScript"> <!-- function random_content(){ var mycontent=new Array() //specify random content below. mycontent[1]='<a href="http://www.xxxxxx.com">link text here 1</a></font>' mycontent[2]='<a href="http://www.xxxxxx.com">link text here 2</a></font>' mycontent[3]='<a href="http://www.xxxxxx.com">link text here 3</a></font>' mycontent[4]='<a href="http://www.xxxxxx.com">link text here 4</a></font>' var ry=Math.floor(Math.random()*mycontent.length) if (ry==0) ry=1 document.write(mycontent[ry]) } random_content() //--> </script> |
![]() |
![]() |
![]() |
#2 |
You can now put whatever you want in this space :)
|
Top of the page (before any HTML):
PHP Code:
P.S. I'm not sure how random the shuffle() function is. You can also create a random_link.php file, dump the code in there, then do an include where you want the link displayed: <? include('path to file..../random_link.php'); ?> Personally though, I would stick with JS, because with PHP you're adding a slight load on the server. Also, I'm sure you can use an external JS file and just call the function in your HTML. Only time I'd use PHP for something like this is if I was dealing with hundreds of links.
__________________
Success is going from failure to failure without a loss of enthusiasm. |
![]() |
![]() |
![]() |
#3 |
Just because I don't care doesn't mean I don't understand!
Join Date: Feb 2004
Posts: 92
|
Thanks Halfdeck
Hey Halfdeck, thanks for your reply. You were right suggesting using java. I was able to adapt the script to use as an external .js. Works the same as php and much easier to set up. Took all of 2 minutes. I set it up with php but wasn't happy with the results. Too much of a pain for the little bit I need it.
Thanks again, Dunkin |
![]() |
![]() |
![]() |
#4 |
You can now put whatever you want in this space :)
|
Np Dunkin
![]()
__________________
Success is going from failure to failure without a loss of enthusiasm. |
![]() |
![]() |
![]() |
#5 |
With $10,000, we'd be millionaires! We could buy all kinds of useful things like ... love!
|
I use a PHP include when I want a list of random links
My random.php is Code:
<?php $codes=array( array('http://www.paysite.com?with&tracking&id','http://www.paysite.com/','PaySite Name'), array('http://www.paysite2.com?with&tracking&id','http://www.paysite2.com/','PaySite2 Name'), array('http://www.paysite3.com?with&tracking&id','http://www.paysite3.com/','PaySite3 Name'), ); shuffle($codes); $i=0; if(!isset($number)) $number=5; while(list(,$code)=each($codes)){ if($i>=$number){break;} echo '<a href="'.$code[0].'" title="'.$code[2].'" onmouseover="window.status=\''.$code[1].'\';return true" onmouseoout="window.status=\'\';return true">'.$code[2]."</a><br />\n"; $i++; } ?> I have different scripts for different niches. (rand-amateur.php, rand-bbw.php, rand-fetish.php, etc) Where-ever I want 5 random links I call Code:
<?php include('/home/path/to/random.php'); ?> Code:
<?php $number=12; include('/home/path/to/random.php'); ?>
__________________
Playboy Webmasters - The name says it all! $35 per signup or 60% revshare. |
![]() |
![]() |
![]() |
#6 |
You can now put whatever you want in this space :)
|
Hi oast,
I have a script similar to that also. My script deals with over 3000 links. When I used to run an include I'd write something along the lines of: <?php require_once("/configfile"); $links = new links(15, "amateur sites"); $links->draw(); ?> But now I'm trying to avoid dynamicly generating those, unless absolutely necessary.
__________________
Success is going from failure to failure without a loss of enthusiasm. |
![]() |
![]() |
![]() |
#7 | |
With $10,000, we'd be millionaires! We could buy all kinds of useful things like ... love!
|
Quote:
Also, you have an extra apostraphe in your first thumb url, this will cause an error. To just show a pic on a page corresponding to the day of the year: PHP Code:
__________________
Playboy Webmasters - The name says it all! $35 per signup or 60% revshare. Last edited by oast; 2006-01-13 at 03:26 PM.. |
|
![]() |
![]() |
![]() |
#8 |
Just because I don't care doesn't mean I don't understand!
Join Date: Feb 2004
Posts: 92
|
Hello Oast,
Success!!! I completely forgot the day was day 13 and only had 10 pictures in the script. I knew it was going to be something just that simple. I cant thank you enough for your help. Actually, I am a kind of glad that it didnt work right away. I really learned a lot by playing with the code, referring to your messages and reading a few tutorials while trying to figure it out. I hope I can return the favor sometime. Again thanks, Dunkin |
![]() |
![]() |
![]() |
#9 | |
With $10,000, we'd be millionaires! We could buy all kinds of useful things like ... love!
|
Your welcome, Dunk
Quote:
![]()
__________________
Playboy Webmasters - The name says it all! $35 per signup or 60% revshare. |
|
![]() |
![]() |
![]() |
|
|