![]() |
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 |
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. |
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 |
Np Dunkin :)
|
I use a PHP include when I want a list of random links
My random.php is Code:
$codes=array( 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:
include('/home/path/to/random.php'); Code:
$number=12; |
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: require_once("/configfile"); $links = new links(15, "amateur sites"); $links->draw(); ?> But now I'm trying to avoid dynamicly generating those, unless absolutely necessary. |
I use similar functions on some of my TGPs, where I have one big file full of links with the niche type as part of the array and use a function call to decide on the niche table to draw.
IMO, as with rotating banners; if there is a list (or table) of links, it is beneficial to have the appearance that the links are being 'updated' rather than seeing the same ones on each visit.. even if it is the same 10 displayed in a different order each time. |
Hello Halfdeck and Oast, thank you both for the info.
I have one more question if you don't mind. Would you happened to know of a php code to show a picture of the day, not random. Show a new picture each day that would draw from a large list of pictures, say a years worth, 365? Thanks again, Dunkin |
PHP has a lot of date related functions, so a list of 365 pictures could be put into an array and a key could be pulled out corresponding to the day of the year.
date(z); gives you a number from 0-365 http://www.php.net/date Here is a simple POTD consisting of 365 images using seperate thumbnails and links to fullsize images PHP Code:
HTH Steve |
Quote:
|
Quote:
For my 'homemade' scripting purposes, I have the luxury of numerous MySQL servers, so I can seperate the tasks (i.e. ad server on one, links db on another, main content on yet another, etc). With the speed of MySQL (2000 lines in 0.4 seconds), I don't think cacheing would make that much difference for my purposes. Another alternative would be to include the MySQL content in an iframe, so the static sections can load independently around it. |
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:
|
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 |
Your welcome, Dunk
Quote:
|
All times are GMT -4. The time now is 07:25 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc