Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Install and Upgrade Help => Aiheen aloitti: hellboy78 - toukokuu 17, 2008, 03:28:39 AP

Otsikko: banner random rotation
Kirjoitti: hellboy78 - toukokuu 17, 2008, 03:28:39 AP
hi everyone

I have SMF 1.1.4. with black to the future themes, and Ad managment installed.

I would like to have some random rotation banners, (fixed banners don't generate much clicks and signups)

wich file I should change and how I should change it???

and how I can manage the random rotation?

thank you in advance
Otsikko: Re: banner random rotation
Kirjoitti: metallica48423 - toukokuu 17, 2008, 03:52:48 AP
you might be able to use the ad management mod to accomplish this (see the customize link at the top of this forum).  You might need to customize the location of the code to accomplish this but its the easiest solution i can think of... but i'm not sure if/how it supports multiple banners/ads though to be honest (i've never used it)

edit: http://custom.simplemachines.org/mods/index.php?mod=255
Otsikko: Re: banner random rotation
Kirjoitti: N3RVE - toukokuu 17, 2008, 04:07:18 AP
This Rotating Ad script can be used*

First, create a file with a name like adverts.php and have this at the top:

      <?
      $bannerCounter= 1;

For each of your advertisements, you'll first write out the ad's code, and then increase the banner counter, like this:

      $bannerCode[$bannerCounter] = "put your ad code here";
      $bannerCounter++;

See a short example; This is a 3-banner rotation. Note that every (") in your ad code needs to be "escaped" with a slash mark in front of the quote mark, like this: \"
This is required for php to properly parse the script

$bannerCode[$bannerCounter] = "<A HREF=\"http://www.amazon.com/exec/obidos/redirect-home/teijn21-20\">
<IMG SRC=\"home-banner-468x60.gif\" BORDER=\"0\" HEIGHT=\"60\" WIDTH=\"468\" alt=\"In Association with Amazon.com\"></A>";
$bannerCounter++;

Next, we get the total number of ads, and if there are more than one, we'll randomly pick one of them. (If less than one, we automatically pick the first advertisement. This may seem like a stupid feature for a random advert generator, but it could happen if you drop non-performing affiliates or if paid-inclusion ads expire :P

$bannerAdTotals = $bannerCounter - 1;
if($bannerAdTotals>1)
{
   mt_srand((double)microtime() * 1234567);
   $bannerPicked = mt_rand(1, $bannerAdTotals);
}
else
{
   $bannerPicked = 1;
}
$bannerAd = $bannerCode[$bannerPicked];

Add a (>
$bannerCode[$bannerCounter] = "<a href=\"http://www.vmcsatellite.com/?aid=55537\" target=\"_top\"> <img src=\"http://www.vmcsatellite.com/banners/468x60(2).gif\" width=\"468\" height=\"60\" alt=\"Free Satellite TV!\" border=\"0\"></a>";
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"http://www.vmcsatellite.com/channels/affiliates.cfm?aid=55537\" target=\"_top\"> <img src=\"http://www.vmcsatellite.com/banners/recruit395x141.gif\" width=\"395\" height=\"141\" alt=\"Free Satellite TV!\" border=\"0\"></a>";
$bannerCounter++;
?>

Now, for the forum - Insert this script using the ad management mod linked in metallica's post.

<?
include_once("adverts.php");
echo "<div align='center'>$bannerAd</div>";
?>


Let us know how it goes :)
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - toukokuu 31, 2008, 06:19:47 AP
this is very interesting,

but,

I have many banners, into differents positions,

may I manage all positions togheter?

what about if I want to random few positions in my forum?

and what about set a "timer" for banners changing,
example: $bannerChangeAfter:60minutes

thank u so much
Otsikko: Re: banner random rotation
Kirjoitti: N3RVE - toukokuu 31, 2008, 11:15:51 AP
You can repeat the code at different sections of the forum!!
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - kesäkuu 10, 2008, 08:16:43 AP
what you mean?

where should I upload PHP with banner rotation???
Otsikko: Re: banner random rotation
Kirjoitti: N3RVE - kesäkuu 10, 2008, 08:32:40 AP
There should be uploaded into the board dir.

-[n3rve]
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - kesäkuu 10, 2008, 09:31:18 AP
I cannot understand!!!

thanks anyway
Otsikko: Re: banner random rotation
Kirjoitti: greyknight17 - kesäkuu 14, 2008, 10:23:44 IP
Which part don't you understand? Upload that script to your SMF directory?
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - kesäkuu 25, 2008, 06:17:08 AP
I'm checking now.

I see that ad managment can accept html and php.

maybe I can put php code for every single area I need to cover with rotation banners...

right?
Otsikko: Re: banner random rotation
Kirjoitti: N3RVE - kesäkuu 25, 2008, 08:51:55 AP
Yes helloboy78 :)

-[n3rve]
Otsikko: Re: banner random rotation
Kirjoitti: Rumbaar - heinäkuu 05, 2008, 03:03:45 AP
Were you able to install your rotating banners hellboy78?  If they were just static 'image' banners I would have though a simple service that offers image rotation would have done.  Now if it's a rotation advertisement banner, this too I'm sure would have been handed by your 'supplier'.
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - heinäkuu 06, 2008, 06:10:44 AP
no rotating banners
Otsikko: Re: banner random rotation
Kirjoitti: Rumbaar - heinäkuu 06, 2008, 06:24:28 AP
Lainaus käyttäjältä: hellboy78 - heinäkuu 06, 2008, 06:10:44 AP
no rotating banners
What does that mean?  There are a number of way to take that, and I wont attempt to guess what you mean.
Otsikko: Re: banner random rotation
Kirjoitti: tatore - heinäkuu 06, 2008, 06:31:54 AP
Since Ad Management Mod doesn't create scripts by itself, but it's the best mod to display *any* kind of code (html, js, php and so on..) what I would do is search a good and secure script or advertising system, create your campaign, put the code into your Ad Management mod.
One of those powerful system could be OpenX (http://www.openx.org/docs/2.4/qsg-install).
I don't know if it is a free source (OpenAds was free).
It requires a database and patience  :P (and bandwidth), but once configured it becomes very very useful, to have a constant monitored position of your adverts, banners(any extension), clicks and so on...
The system generates what you require, from js to iframes, and once generated you paste the code in your Ad Management mod, to display it where you want-
Other easier solutions can be  found @ http://www.hotscripts.com/ (http://www.hotscripts.com/)
Otsikko: Re: banner random rotation
Kirjoitti: hellboy78 - heinäkuu 06, 2008, 06:42:18 AP
my smf is on servage hosting.

I had few problems to install mods, and now, doing rotation banner, an error is showed.

so I think I cannot put rotation banners.
Otsikko: Re: banner random rotation
Kirjoitti: Rumbaar - heinäkuu 06, 2008, 06:42:51 AP
Even something as basic as this might work, just whipped it up
<?php
$img 
= array("image1.jpg","image2.jpg","image3.jpg");
$i rand(0,2);
$image $img[$i];
echo 
'<img src="static URL/$image">';
?>
Just add more images to the array and increase the rand range.  Then have the Static URL correct for the location of the image you'll be using.
Otsikko: Re: banner random rotation
Kirjoitti: DirtRider - heinäkuu 06, 2008, 07:11:32 AP
Well I am using this code with TinyPortal to place it where I want it, see here http://www.s247631067.onlinehome.us/index.php (http://www.s247631067.onlinehome.us/index.php)



<script language="JavaScript">
<!-- Begin
var ad_cnt1 = 4;
var now1 = new Date()
var sec1 = now1.getSeconds()
var ad1 = sec1 % ad_cnt1;
ad1 +=1;
if (ad1==1) {
url1="YOUR-DOMAIN-HERE";
banner1="URL_OF_BANNER";
width1="468";
height1="60";
alt1="ALT TEXT HERE";
}
if (ad1==2) {
url1="YOUR-DOMAIN-HERE";
banner1="URL_OF_BANNER";
width1="468";
height1="60";
alt1="ALT TEXT HERE";
}
if (ad1==3) {
url1="YOUR-DOMAIN-HERE";
banner1="URL_OF_BANNER";
width1="468";
height1="60";
alt1="ALT TEXT HERE";
}
if (ad1==4) {
url1="YOUR-DOMAIN-HERE";
banner1="URL_OF_BANNER";
width1="468";
height1="60";
alt1="ALT TEXT HERE";
}
document.write('<center><a href="' + url1 + '" target="_blank">');
document.write('<img src="' + banner1 + '" width=' + width1 + ' height=' + height1 + ' border=0 alt="' + alt1 + '"></a>');
document.write('</center>');
// End -->
</SCRIPT>



Otsikko: Re: banner random rotation
Kirjoitti: Rumbaar - heinäkuu 09, 2008, 07:11:47 IP
Well how did you exactly add your rotating banners hellboy78?  What is the specific error?