TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 12:58:45 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 101
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 68
  • Total: 68

Multiple banner ad rotator?

Started by Adamzon, January 22, 2007, 12:44:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alfie


Adamzon

U are great!
Thanx!

www.glidarhoj.se

JPDeni

Cool.  8)

This will really work for anything. If you have a list of somethings and you want to display one or more of them randomly, this is the easiest way to do it. There are a couple of situations that you might want to get a little fancier, but this will work for most things.

Inge Jones

This works great for my featured site links, thank you! :)

Inge Jones

I am double posting as this is several days later and a new subject:

Is there any way to adapt this code so that I can use it to display random images from either my attachments or tp-dowloads folders?   I think my attempts are being blocked by the .htaccess of those directories, and I don't want to remove them really.  Any way round this?

My reason for wanting to use these folders is I wish my users to be able to update their images by themselves.

IchBin

If you try to get around by changing the access with htaccess you're more than likely going to end up with people being able to access the downloads folder and download whatever they'd like. As its setup now, there's no direct linking allowed, for obvious reasons. Sounds to me like you need a custom download/upload download script to get what you want.

Inge Jones

I have made a custom upload script which does work, but I don't really want the folder publicly accessible, only by someone running my script.   How does TP manage to get into its own tp-uploads folder with that .htaccess in place?

insanemustang

Quote from: JPDeni on January 22, 2007, 03:21:58 PM
Create a php block.

Put the following code in it, filling in the urls to your banners and links as needed, one per line:


$banners = array (
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>',
'<a href="http://link/to/site" target="_blank"><img src="http://url/to/img"></a>'
);

shuffle($banners);

echo $banners[0];


It's easy to edit, you don't have to have any external files, and you can have as many or as few banners as you want.

Just wanted to thank JPDeni, this code works great.

FUBAR

The code is great but unfortunately it doesn't work with Firefox. 

Any suggestions?

Zetan

The code works fine in Firefox on my site. It would have been mentioned before if it didn't.