MyBB Community Forums

Full Version: Want to run my own ads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have created a single gif that has 3 different ad's that rotate, I can add it to my advertisements but I can only put in 1 link, I need to make them link to the 3 different sites when they rotate. Maybe I'm using the wrong plug-in...Any suggestions?
You need 3 different images if you want to link to 3 different sites. Or, need something like flash.
well if I made 3 different images, which I can do, is there a plug in to play #1 for a few seconds then change to # 2 and so one?
added:
I noticed http://mods.mybb.com/view/daily-sponsor-bar , will that do the trick?

and thanks Alex for your reply
Not that I know of. But, it is possible with javascript.
JavaScript would be the way to go.

Load a script with an array of 3 image URLs and the 3 destination URLs. Then have a timer cycle through them. Then have JavaScript alter a HTML anchor element to display the correct URL and image.
I'm pretty sure there might be plugins out there to put your own ads on your website.
I have an image rotater on my homepage, it's only a few lines of code using jQuery. You can see it here: http://mybbconnect.com/index.php

If its what you need let me know and I'll give you the code.
can you create a different link to each image? if so sure...I'd appreciate the code.
You can do it with Template Conditionals http://mybbhacks.zingaburga.com/showthread.php?tid=464 if you want it simple without animation. Remember to put the .txt from package to inc/plugins.

Then put this in any template:
<setvar randomadnumber>rand(1,3)</setvar>
<if $tplvars['randomadnumber'] == 1 then>
<a href="www.myfirstlink.com"><img alt="" src="images/myfirstimg.png" /></a>
<elseif $tplvars['randomadnumber'] == 2 then>
<a href="www.mysecondlink.com"><img alt="" src="images/mysecondimg.png" /></a>
<else>
<a href="www.mythirdlink.com"><img alt="" src="images/mythirdimg.png" /></a>
</if>

It will rotate on each page refresh, not sure if that's what you meant, otherwise you need JS like this http://jquery.malsup.com/cycle/
try dis code.

<script language="Javascript">
<!--


var currentdate = 0;
var core = 0;

function initArray() {

this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}

link = new initArray(
"http://www.linkofsite1.com",
"http://www.linkofsite2.com",
"http://www.linkofsite3.com"

);

image = new initArray(
"http://linkofbanner1.com",
"http://linkofbanner2.com",
"http://linkofbanner3.com"

);

text = new initArray(
"Name Of Site1",
"Name Of Site2",
"Name Of Site3"

);

var currentdate = new Date();
var core = currentdate.getSeconds() % image.length;
var ranlink  = link[core];
var ranimage = image[core];
var rantext  = text[core];

document.write('<a href=\"' +ranlink+ '\" target=\"_blank\"><img src=\"'+ranimage+'\" border="0" alt=\"'+rantext+'\"></a>');

//-->
</SCRIPT>