Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 09:00:43 PM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 60
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 46
Total: 46

Author Topic: Multiple banner ad rotator?  (Read 21239 times)

0 Members and 1 Guest are viewing this topic.

alfie

  • Guest
Re: Multiple banner ad rotator?
« Reply #10 on: January 23, 2007, 04:55:13 AM »
that rocks jpdeni thank you

Adamzon

  • Guest
Re: Multiple banner ad rotator?
« Reply #11 on: January 23, 2007, 05:24:55 AM »
U are great!
Thanx!

www.glidarhoj.se

JPDeni

  • Guest
Re: Multiple banner ad rotator?
« Reply #12 on: January 23, 2007, 07:12:46 AM »
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

  • Guest
Re: Multiple banner ad rotator?
« Reply #13 on: January 25, 2007, 08:40:12 AM »
This works great for my featured site links, thank you! :)

Inge Jones

  • Guest
Re: Multiple banner ad rotator?
« Reply #14 on: January 30, 2007, 05:13:19 AM »
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.

Offline IchBin

  • Friends
  • *
  • Posts: 16231
Re: Multiple banner ad rotator?
« Reply #15 on: January 30, 2007, 09:00:22 AM »
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

  • Guest
Re: Multiple banner ad rotator?
« Reply #16 on: January 30, 2007, 09:07:03 AM »
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

  • Guest
Re: Multiple banner ad rotator?
« Reply #17 on: May 07, 2007, 09:05:08 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:

Code: [Select]
$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.

Offline FUBAR

  • Jr. Member
  • **
  • Posts: 98
Re: Multiple banner ad rotator?
« Reply #18 on: May 15, 2007, 02:19:14 AM »
The code is great but unfortunately it doesn't work with Firefox. 

Any suggestions?

Offline Zetan

  • Friends
  • *
  • Posts: 3471
Re: Multiple banner ad rotator?
« Reply #19 on: May 15, 2007, 02:53:01 AM »
The code works fine in Firefox on my site. It would have been mentioned before if it didn't.