Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] Simple ADS rotation (sNews All Versions)  (Read 6360 times)

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
[MOD] Simple ADS rotation (sNews All Versions)
« on: October 27, 2006, 02:55:28 pm »

Well, like the subject say, this is a simple, really simple, MOD for rotating your site banners for ADS or whatever you want.
Let's go! :cool:
First of all,  bla bla bla (make a backup)  :P
Put this piece of code into your snews.php file (no special location is needed) :
Code: [Select]
// MOD : Random Banner Rotation for ADS by bramsyuur
function banner_rnd() {
$numbanners = 3; //number of banners to be rotated
$random = rand(1,$numbanners);
$img = array();
$url = array();
$txt = array();

$img[1] = "/your_image_folder/banner1.gif";   // Banner number 1
$url[1] = "http://external_url_link_1.com";
$txt[1] = "Look at our sponsor number 1";

$img[2] = "/your_image_folder/banner2.gif";   // Banner number 2
$url[2] = "http://external_url_link_2.com";
$txt[2] = "Look at our sponsor number 2";

$img[3] = "/your_image_folder/banner3.gif";   // Banner number 3
$url[3] = "http://external_url_link_3.com";
$txt[3] = "Look at our sponsor number 3";

echo "$txt[$random]";
}
And you can call this function into your index.php template with:
Code: [Select]
This is all for this little but efective mod.
* No actually have a working site with it, soon I'll post a working online demo *
Thanks,
bram.
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Español

ketut

  • Full Member
  • ***
  • Karma: 0
  • Posts: 115
    • Book Bali Hotels
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #1 on: October 27, 2006, 03:40:27 pm »

Thanks for good addons mr. bram   :cool:
Is it possible to strore banner data in database? So we can manage trough the admin and have unlimited banner rotation.

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #2 on: October 27, 2006, 03:48:40 pm »

Thanks Kebut.
Offcourse it's possible. Get me a few days and I'll post an update.
Thanks,
bram.
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Español

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #3 on: January 25, 2007, 06:04:03 pm »

so freaking great, Bram-san... I have a adbanner rotator on my site (well a bit more actually, it's infact a gallery script) that is quite "heavy", so this one looks awsome ;). I'll wait for that DB update, or will I ???  I can't decide...

Could you please, seperate these two different things when updating ? that is leaving this as it is, and then under it post the DB version ? So anyone can choose what version to use ;)...

Thanks again, Bram - Patric.
Logged
"It's only dead fish that goes with the flow... "
Updated

David

  • Hero Member
  • *****
  • Karma: 7
  • Posts: 567
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #4 on: January 25, 2007, 06:49:47 pm »

just add a fade effect in this script and it will be perfect  :D
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #5 on: January 26, 2007, 01:16:09 pm »

Yea, forgot that !! Is this fixable, Bram... a editable fade thingy ?
Logged
"It's only dead fish that goes with the flow... "
Updated

David

  • Hero Member
  • *****
  • Karma: 7
  • Posts: 567
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #6 on: January 26, 2007, 02:36:48 pm »

the only way to make this fade effect is javascript...

The Bram's script change the banner only on the page  reload.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #7 on: January 26, 2007, 03:02:07 pm »

I am sure I posted a nice little fade-in-fade-out solution for rotating ad banners & other images somewhere on these forums not too long ago... but I cannot find it here by searching (arrghh). But there are a number of slideshow effects scripts available on this page at Dynamic Drive. The one I modded for sNews is on This Page and works well. I put the script in a slidejs.php file (in the site root) and used a simple include thingie in the index.php to call it:
Quote

      
      
      
The slidejs.php file allows you to have several independent slide shows (image rotators) running at the same time in the same site (details in the script) and each one gets called using the same block above but each would have its own unique name in the new fadeshow(... string before the closing script-tag. The one shown is calle [fadeimages[/b] and its list of images in in slidejs.php. For another group of images, you add another array with a new name... say... fadeimages2... copy the script above into where you want the second image show... and chnage the new fadeshow name to fadeimages2.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #8 on: January 27, 2007, 08:26:57 am »

Forgive me my morning temper, Key's... And thus my intelligence :lol: do this make it both fade and fade into other image within the time frame I want, rather than on page reload ?
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #9 on: January 27, 2007, 03:05:25 pm »

It's probably well after lunch-time in Sweden by now but it is the start of my morning here (9:00 a.m.)
Patric... answer to your question... yes! The images fade out and into the next one, one after the other, according to the order you list the image file-paths in... in the array in the slidejs.php file. There is no need to refresh the page to change images... they change themselves. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

brauck

  • Hero Member
  • *****
  • Karma: 18
  • Posts: 556
    • http://www.hbw-webdesign.nl/
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #10 on: January 27, 2007, 03:31:40 pm »

Quote
There is no need to refresh the page to change images... they change themselves.
That's because it's js  :)
Logged
Confidence is reduced complexity.
brauck.nl for free css templates

David

  • Hero Member
  • *****
  • Karma: 7
  • Posts: 567
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #11 on: January 27, 2007, 04:02:29 pm »

you can also use http://smoothgallery.jondesign.net/ to make a good advert system with some good effects but if you need only the fade effect, the Bram and Keyrocks solution is sufficient .
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Simple ADS rotation (sNews All Versions)
« Reply #12 on: January 28, 2007, 11:31:13 am »

Mhm... As you, David I am using smooth... But it's so darn big ;), and I personally is just after what I currently have on my site at the moment (although styled and designed in a far more better way, as my site isn't ready yet ;) ) Some banners linked to sites, which is swapping in a fading fashion like this... I'm gonna try this out... when time permits.
Logged
"It's only dead fish that goes with the flow... "
Updated