Rotating banner script

Here you can discuss the various webmaster affiliate programs
User avatar
Doc
Moderator and Beast Killer
Posts: 2978
Joined: Mon Jun 04, 2007 5:33 pm
Location: Reporting Posts Since Oct 23. 2007
Contact:

Re: Rotating banner script

Postby Doc » Sat Mar 24, 2012 12:57 am



User avatar
oliver
Site Admin
Posts: 4417
Joined: Sat Sep 23, 2006 11:18 pm
Contact:

Re: Rotating banner script

Postby oliver » Sat Mar 24, 2012 2:02 am

The span style was definitely not going to work, it contained double quotes, while you can only resort to single quotes (apostrophe, the word exists, in english ?) because the javascript is already using double quotes.

But the other one looked okay to me...

Did you try escaping all special characters, like the ? with & amp ; or the € with & euro ; ?
(I added spaces, not sure if phpbb wouldn't convert it by himself otherwise)

Or else, try experimenting with super simple syntax, bit.ly links to remove everything fishy, you see the idea...
User avatar
cooper88
Moderator
Posts: 4055
Joined: Sat May 27, 2006 2:54 pm
Location: None of UR Business
Contact:

Re: Rotating banner script

Postby cooper88 » Sat Mar 24, 2012 5:25 pm

...
User avatar
Doc
Moderator and Beast Killer
Posts: 2978
Joined: Mon Jun 04, 2007 5:33 pm
Location: Reporting Posts Since Oct 23. 2007
Contact:

Re: Rotating banner script

Postby Doc » Sat Mar 24, 2012 9:25 pm



User avatar
oliver
Site Admin
Posts: 4417
Joined: Sat Sep 23, 2006 11:18 pm
Contact:

Re: Rotating banner script

Postby oliver » Sat Mar 24, 2012 9:57 pm

I can't find what made the big "works VS doesn't work" difference between the first and second versions O_o
User avatar
cooper88
Moderator
Posts: 4055
Joined: Sat May 27, 2006 2:54 pm
Location: None of UR Business
Contact:

Re: Rotating banner script

Postby cooper88 » Sun Mar 25, 2012 12:07 pm

Well, 1st off, you are right: A " would break the javascript so either use \" or a ' instead.

2nd, using a span tag wouldn't have much effect since what's inside it is a link and not simple text.

And in the last version Doc showed I almost didn't spot the error it was so BAM in your face:
banners[0] = "Join 100% Free - Webcams/Chat <a target='_blank' href='http://chaturbate.com/affiliates/in/ZmU7/pOjlh/?track=default'>some anchor</a>";
>> That clearly isn't proper html and shouldn't work :roll:
...
User avatar
Doc
Moderator and Beast Killer
Posts: 2978
Joined: Mon Jun 04, 2007 5:33 pm
Location: Reporting Posts Since Oct 23. 2007
Contact:

Re: Rotating banner script

Postby Doc » Sun Mar 25, 2012 5:08 pm

It works fine with this € and /

http://dirtydirtyangels.com/forum/ see just about where it says welcome guest.

oliver:

It might of been the some anchor thing

<a target='_blank' href='http://chaturbate.com/affiliates/in/ZmU7/pOjlh/?track=default'>some anchor</a>


User avatar
Doc
Moderator and Beast Killer
Posts: 2978
Joined: Mon Jun 04, 2007 5:33 pm
Location: Reporting Posts Since Oct 23. 2007
Contact:

Re: Rotating banner script

Postby Doc » Fri Sep 21, 2012 7:53 pm

i finally found the topic. sorry for all the confusion oliver. :D

Anyway is there anyway of making this so i can do banner rotation?

<script language="JavaScript">
<!--
banners = new Array(2);
banners[0] = "<a style='color:lightblue;' target='_blank' href='http://YOURLINK.com'>YOUR TEXT 1</a></span>";
banners[1] = "<a style='color:red;' target='_blank' href='http://YOURLINK.com'>YOUR TEXT 2</a></span>";
index = Math.floor(Math.random() * banners.length);
document.write(banners[index]);
// -->
</script>


User avatar
cooper88
Moderator
Posts: 4055
Joined: Sat May 27, 2006 2:54 pm
Location: None of UR Business
Contact:

Re: Rotating banner script

Postby cooper88 » Sat Sep 22, 2012 7:30 am

Erm, wasn't this solved already back in March? Doesn't it work anymore Doc?
I tried it and it is working fine.

BTW, there is no need for the </span> tags, they should be removed.
...
User avatar
Doc
Moderator and Beast Killer
Posts: 2978
Joined: Mon Jun 04, 2007 5:33 pm
Location: Reporting Posts Since Oct 23. 2007
Contact:

Re: Rotating banner script

Postby Doc » Sat Sep 22, 2012 9:23 pm

It worked fine with link/text rotation. I just want to use it on another site, but instead of it rotating text. i would like it to rotate images.



[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 2 guests