The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Making banner change on refresh in a better spot

4 posters

Go down

In progress Making banner change on refresh in a better spot

Post by Toucan August 5th 2011, 7:27 pm

What I want : A banner on top to change every time I refresh.

What I searched : This https://help.forumotion.com/t93201-banner-script?highlight=banner+changes+every+time+you+refresh
So I used the generator located in that OLD thread.
Changed the coding to adjust the size

So basically this is the code
Code:

<script type="text/javascript">
<!-- Begin
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
   var result = Math.ceil(rnd()*number);
   if (!result)result++;
        return result
};
var ad_cnt3 = 3;
var ad3 = rand(ad_cnt3);
var link3;
var adBanner3;
var width3
var height3
if (ad3==1) {
link3="http://www.maple-guide.com/";
adBanner3="http://i909.photobucket.com/albums/ac298/iroxsta/v2.png";
width3="800";
height3="200";
alt3="";
}
if (ad3==2) {
link3="http://www.maple-guide.com/";
adBanner3="http://i52.tinypic.com/2lc63j4.jpg";
width3="657";
height3="140";
alt3="";
}
if (ad3==3) {
link3="http://www.maple-guide.com/";
adBanner3="http://i53.tinypic.com/11jut5v.jpg";
width3="318";
height3="150";
alt3="";
}
document.write('<center><a href="' + link3 + '" target="_top">');
document.write('<img src="' + adBanner3 + '" width=' + width3 + ' height=' + height3 + ' border=0 alt="' + alt3 + '"></a>');
document.write('</center>');
// End -->
</SCRIPT>

One of the posts in that thread says to put it in Display >Generalities >Home page message
It works but I don't like how it's in the box/table

Is there a way to make it on top where normal banners are usually located?


edit: SORRY I DON'T KNOW IF THIS IS THE RIGHT SECTION
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Nera. August 5th 2011, 7:37 pm

Hi,

This should help you https://help.forumotion.com/t93791-multi-banners#608754 . I'd use Vlajki's example. It's the simpiest and works.
Nera.
Nera.
Energetic

Female Posts : 7078
Reputation : 2017
Language : English
Location : -

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 5th 2011, 8:07 pm

so i can't use coco's post since it's ph3 only

so i went on to the randimg thing
Every time i upload my banner it keeps saying upload fail.

Does it not support PNG images? just wondering.

edit:I guess it only supports jpg... which is bad since the quality on those things are horrid.
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Nera. August 5th 2011, 8:51 pm

It should. Click on this link a fiew times you'll see three different pictures
http://pile.randimg.net/0/29/7425/moje.png
Nera.
Nera.
Energetic

Female Posts : 7078
Reputation : 2017
Language : English
Location : -

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 5th 2011, 11:07 pm

What program did you use to save it? How did you save it?
I have a banner with some transparent areas. Tried to upload it, still nothing.
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Nera. August 5th 2011, 11:12 pm

There is no program.

If you found a .png photo online when saveing it on computer with right click you have an option Save as: choose png.

The same thing is when makeing it in PS. Save as = transparent .png

If you upload it here even it will stay .png http://i.imm.io/7GpX.png

So is the same with randoming.net

Edit: You are aware that when you make a pile you have to click on the small link and take that link it offeres you like I did hare and use it as your logo. Do not save it or reupload it. It will look like mine here.
Nera.
Nera.
Energetic

Female Posts : 7078
Reputation : 2017
Language : English
Location : -

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 5th 2011, 11:18 pm

I know...
but this keeps happening
Making banner change on refresh in a better spot 35i0le9

this is one of the banners im trying to use
https://2img.net/h/oi54.tinypic.com/2j64x37.jpg
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by coco moco August 6th 2011, 3:34 am

My version works just fine Razz I also couldn't get a thing to load on that site other than avatars Very Happy
coco moco
coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 6th 2011, 9:36 am

coco moco wrote:My version works just fine Razz I also couldn't get a thing to load on that site other than avatars Very Happy
You mean your "How to get a multibanner in PHPBB3" thing works for PHPBB2?
I didn't bother trying it seeing as you said it's only for PHP3.
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by coco moco August 6th 2011, 10:01 am

The method as I described will only work for PHPBB3, you could change the selector, though, and it would work for PHPBB2. There may be an easier way, though.

If I remember rightly, you have access to the overall header template? Found in templates=>general

Can you not just insert the code generated at http://www.htmlbasix.com/banner.shtml into the template?

I may be missing my guess, but surely that's where the banner is?
coco moco
coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 6th 2011, 7:16 pm

coco moco wrote:The method as I described will only work for PHPBB3, you could change the selector, though, and it would work for PHPBB2. There may be an easier way, though.

If I remember rightly, you have access to the overall header template? Found in templates=>general

Can you not just insert the code generated at http://www.htmlbasix.com/banner.shtml into the template?

I may be missing my guess, but surely that's where the banner is?

I've done that, and strangely, nothing showed. :/
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by coco moco August 6th 2011, 8:43 pm

Try this then - put the javascript in your homepage message.

The html that's created put in your header template (if it works can worry about styling afterwards).
coco moco
coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 7th 2011, 12:51 am

Wait a minute.. is it possible because I got a different kind of code?


*I tried this code in homepage message and it worked except, still dislike how it's not on top of the forum.
Code:



<script type="text/javascript">
<!-- Begin
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
   var result = Math.ceil(rnd()*number);
   if (!result)result++;
        return result
};
var ad_cnt3 = 3;
var ad3 = rand(ad_cnt3);
var link3;
var adBanner3;
var width3
var height3
if (ad3==1) {
link3="http://www.maple-guide.com/";
adBanner3="http://i909.photobucket.com/albums/ac298/iroxsta/v2.png";
width3="800";
height3="200";
alt3="";
}
if (ad3==2) {
link3="http://www.maple-guide.com/";
adBanner3="http://i52.tinypic.com/2lc63j4.jpg";
width3="657";
height3="140";
alt3="";
}
if (ad3==3) {
link3="http://www.maple-guide.com/";
adBanner3="http://i53.tinypic.com/11jut5v.jpg";
width3="318";
height3="150";
alt3="";
}
document.write('<center><a href="' + link3 + '" target="_top">');
document.write('<img src="' + adBanner3 + '" width=' + width3 + ' height=' + height3 + ' border=0 alt="' + alt3 + '"></a>');
document.write('</center>');
// End -->
</SCRIPT>

Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by coco moco August 7th 2011, 4:13 am

A different code does seem to be the case, for a page reload.

Code:
<script type="text/javascript">
var imgs1 = new Array("www.test.com","www.test.com","www.test.com");
var alt1 = new Array();
var currentAd1 = 0;
var imgCt1 = 3;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
  banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  currentAd1++;
}
  window.setInterval("cycle1()",30000);
</script>
<img src="www.test.com" id="adBanner1" border="0" width="468" height="60"></a>

Is what you get if you had it on a time delay. As you can see it generates html
Code:
<img src="www.test.com" id="adBanner1" border="0" width="468" height="60"></a>

Hmmm, I wonder if we tweaked it a bit, and used the code to replace your current banner. It does have an ID so should be fine to select, and you could put an empty gif up so as not to hinder page loading. I have a fair bit to do this morning, but leave it with me Smile
coco moco
coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 7th 2011, 10:45 pm

thanks I guess.

I'm still gonna keep playing around til I get to work. Might even switch forum versions just to do it. :/
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by coco moco August 8th 2011, 6:14 am

Hiya, sorry I didn't get back to you. I had an extremely busy day yesterday.

I had a little play around and I've had not much luck on pageload. However, it works absolutely perfectly on a timer. I will have another look when I get a chance, to see if it can't be cracked, and in the meantime maybe someone can see something I'm missing Smile

If you want it on a timer (and I used your images, and got them looking pretty good on a 20 second loop), go to htmlbasix, input your code and set your time delay (it may be an idea to have all the images the same size as you don't have an option for each image, you could just put your smaller images on a transparent background).

The code it generates will be in 2 parts. The first part in <script></script> tags needs to go in your homepage message.

The HTML part generated at the end, needs to go in your overall header.
Code:
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
               <tr>
                  <!-- BEGIN switch_logo_left -->
                  <td><a href="{U_INDEX}"><img src="{LOGO}" id="i_logo" border="0" alt="{L_INDEX}" vspace="1" /></a></td>
                  <!-- END switch_logo_left -->
                  <td align="center" width="100%" valign="middle">
                     <!-- BEGIN switch_logo_center -->
                     <a href="{U_INDEX}"><img src="{LOGO}" id="i_logo" border="0" alt="{L_INDEX}" vspace="1" /></a>
                     <br />
                     <!-- END switch_logo_center -->
                     <div class="maintitle">{MAIN_SITENAME}</div>
                     <br />
                     <span class="gen">{SITE_DESCRIPTION}<br />  </span>
                  </td>
                  <!-- BEGIN switch_logo_right -->
                  <td><a href="{U_INDEX}"><img src="{LOGO}" id="i_logo" border="0" alt="{L_INDEX}" vspace="1" /></a></td>
                  <!-- END switch_logo_right -->
               </tr>
            </table>

I replaced every link and image with the comparative code generated by htmlbasix
Code:
<a href=""blah1"" id="adLink1" target="_top">
<img src="blah" id="adBanner1" border="0" width="468" height="60"></a>
replaces the 3 instances of
Code:
<a href="{U_INDEX}"><img src="{LOGO}" id="i_logo" border="0" alt="{L_INDEX}" vspace="1" /></a>
in this example.

I tried changing the javascript
Code:
<script type="text/javascript">
var imgs1 = new Array("blah","blah");
var lnks1 = new Array("blah1","blah1");
var alt1 = new Array();
var currentAd1 = 0;
var imgCt1 = 2;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
  banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  currentAd1++;
}
  window.setInterval("cycle1()",10000);
</script>

Into a function that's called on pageLoad, where a random number from the array is called, but where ever I put it, it wasn't playing ball. I'm probably missing something rather obvious, and I'm not sure when I'll get a chance to look again Sad

I'd suggest, putting the banner up to rotate on a cycle, while looking for the ideal solution, it does look pretty good. Dion over at http://diondesigns.forumotion.com/ is quite a dab hand with the coding (though he doesn't like phpbb2), and he might be able to help you sort it out.
coco moco
coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 8th 2011, 7:16 am

I appreciate the effort!

The timer works, although still unfavorable for my liking (xD I'm so picky) but I guess I'll stick with the timer for now.
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by kirk August 8th 2011, 7:24 am

send me the images and i will make you a new code.
I have a banner maker with a rotating banner option as well,

so ok you want it to change to a different banner each time you click to a different page or refresh, do you want the banners in a random order or in a certain back to back order?

So send me the images and i will put it together for you.
Oh i can only fit up to eight different images/banners but that should be plenty.

Oh i can add different links to each image as well, so dont know if you want different click-able links in the banners or not, but if you do be sure to send me the links and what one will go with what banner.

and as far as your images not uploading, you have to be sure you are useing a image host that allows png, depending on the size of the files they will not always upload right with servimg, so you may want to get a photobucket account, you cant even upload them to imageshack anymore without paying.. i hate it. it's bull dung... lol

kirk
kirk
Forumaster

Male Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

In progress Re: Making banner change on refresh in a better spot

Post by Toucan August 8th 2011, 10:48 am

kirk wrote:send me the images and i will make you a new code.
I have a banner maker with a rotating banner option as well,

so ok you want it to change to a different banner each time you click to a different page or refresh, do you want the banners in a random order or in a certain back to back order?

So send me the images and i will put it together for you.
Oh i can only fit up to eight different images/banners but that should be plenty.

Oh i can add different links to each image as well, so dont know if you want different click-able links in the banners or not, but if you do be sure to send me the links and what one will go with what banner.

and as far as your images not uploading, you have to be sure you are useing a image host that allows png, depending on the size of the files they will not always upload right with servimg, so you may want to get a photobucket account, you cant even upload them to imageshack anymore without paying.. i hate it. it's bull dung... lol

bwi

Basically just random.
I'd ask you what you're going to supply to see if I can simply edit it the "code" to my liking but then again...

https://2img.net/h/oi51.tinypic.com/2cok9yc.jpg
https://2img.net/h/oi56.tinypic.com/28tf08.jpg
https://2img.net/h/oi52.tinypic.com/2lc63j4.jpg

Thanks :}
Toucan
Toucan
Forumember

Male Posts : 27
Reputation : 0
Language : English

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum