php forum
php mysql forum
php mysql smarty
 
Page 2 of 2 < 1 2
Topic Options
#281030 - 10/26/04 05:17 AM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: smoknz28]
ChAoS_dup1 Offline
Code Monkey

Registered: 11/15/02
Posts: 576
Loc: Great Northwest
Doing all of that did something funky to the table rows and bonked the layout of the page,didn't see a banner either. Its late so I will try again tomorrow-Thanks for the hard work Twisty
_________________________
ChAoS
Emerald Forest Gaming Servers
Official STFU Thread


Top
#281031 - 10/26/04 06:29 AM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: barbiro]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
I found the mistake, all fixed now (redownload the attachment). I personally tested it on my site <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" /> <br /> <br />The new method is even simpler, you no longer have to <br />edit ubbt.inc.php <br />
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
#281032 - 10/26/04 10:13 AM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: smoknz28]
ChAoS_dup1 Offline
Code Monkey

Registered: 11/15/02
Posts: 576
Loc: Great Northwest
wow Twisty thats great,thanks for the hard work on that <br /> <br />*edit* This is working great Twisty-Thanks again!! *edit* <br /> <br />I know how much time you spent on it


Edited by ChAoS (10/26/04 12:37 PM)
_________________________
ChAoS
Emerald Forest Gaming Servers
Official STFU Thread


Top
#281033 - 10/26/04 12:56 PM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: barbiro]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
Ok good to hear <img src="http://www.ubbdev.com/forum/images/graemlins/cool.gif" alt="" />
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
#281034 - 10/26/04 01:03 PM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: smoknz28]
ChAoS_dup1 Offline
Code Monkey

Registered: 11/15/02
Posts: 576
Loc: Great Northwest
Would it be hard to add in a variable that would rotate them without refreshing the page? <br />Maybe something similar to this? <br /> <br /> <br /><?php // DynAds: Display an ad per period <br /> $StartDate = "15 January 2004" ; <br /> $PeriodHours = 24 ; <br /> $AdGroup = "NameOfTheAdGroup" ; <br /> $DispPosName = "NameForThisAdDisplayPosition" ; <br /> $ScriptUrl = "http://YourDomain/DynAdsInstallPath/ad.pl" ; <br />// No editing beyond this line <br /> $PerCount = (int)((time() - strtotime($StartDate)) / ($PeriodHours*60*60)) ; <br /> $url = $ScriptUrl . "?pos=" . urlencode($DispPosName) . "&agn=" . urlencode($AdGroup) . "&dsp=html&sel=seq&ano=" . $PerCount ; <br /> @include($url) ; <br />?> <br /><<<<gets ready to duck and run <br /> <br /> <br />$ScriptUrl = "http://YourDomain/DynAdsInstallPath/ad.pl" ; <br /> <br />could be taken out and replaced with banners.inc.php (I think) <br /> <br />maybe like so <br /> <br /><?php // DynAds: Display an ad per period <br />$StartDate = "15 January 2004" ; <br />$PeriodHours = 24 ; <br />$AdGroup = "Test" ; <br />$DispPosName = "Test" ; <br />$ScriptUrl = "http://emeraldforestseattle.nuclearfallout.net/ubbthreadss/includes/banners.inc.php" ; <br />// No editing beyond this line <br />$PerCount = (int)((time() - strtotime($StartDate)) / ($PeriodHours*1*1)) ; <br />$url = $ScriptUrl . "?pos=" . urlencode($DispPosName) . "&agn=" . urlencode($AdGroup) . "&dsp=html&sel=seq&ano=" . $PerCount ; <br />@include($url) ; <br />?> <br /> <br />and it would rotate every minute <br /> <br />or is this over killl and I should just use Meta Refresh?


Edited by ChAoS (10/26/04 01:15 PM)

Top
#281035 - 10/26/04 02:47 PM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: barbiro]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
[]ChAoS said: <br />Would it be hard to add in a variable that would rotate them without refreshing the page? <br />Maybe something similar to this? <br /> <br /> <br /><?php // DynAds: Display an ad per period <br /> $StartDate = "15 January 2004" ; <br /> $PeriodHours = 24 ; <br /> $AdGroup = "NameOfTheAdGroup" ; <br /> $DispPosName = "NameForThisAdDisplayPosition" ; <br /> $ScriptUrl = "http://YourDomain/DynAdsInstallPath/ad.pl" ; <br />// No editing beyond this line <br /> $PerCount = (int)((time() - strtotime($StartDate)) / ($PeriodHours*60*60)) ; <br /> $url = $ScriptUrl . "?pos=" . urlencode($DispPosName) . "&agn=" . urlencode($AdGroup) . "&dsp=html&sel=seq&ano=" . $PerCount ; <br /> @include($url) ; <br />?> <br /><<<<gets ready to duck and run <br />[/] <br /> <br />Ewww. <br /> <br />What you'll want to do is use client-side scripting for this task ie. Javascript as opposed to server-side scripting ie. PHP <br /> <br />So try this instead then. Add the following code to your generic template where the PHP include line is from my original mod which won't be needed anymore... <br /> <br />
Code:
 &lt;script language="JavaScript"&gt; <br /> &lt;!-- <br /> function adArray() { <br />  for (i=0; i*2&lt;adArray.arguments.length; i++) { <br />   this[i] = new Object(); <br />   this[i].src = adArray.arguments[i*2]; <br />   this[i].href = adArray.arguments[i*2+1]; <br />  } <br />  this.length = i; <br /> } <br /> function getAdNum() { <br />  dat = new Date(); <br />  dat = (dat.getTime()+"").charAt(8); <br />  if (dat.length == 1) <br />   ad_num  = Math.floor(Math.random() * ads.length); <br />  else <br />   ad_num = 0; <br />  return ad_num; <br /> } <br /> var ads = new adArray( <br /> <br /> "/ubbthreads/images/banners/bajbnr.jpg","http://www.bajema.com", <br /> "/ubbthreads/images/banners/melancholicban.jpg","http://melancholic.net", <br /> "/ubbthreads/images/banners/decayingmadness.gif","http://www.decayingmadness.com", <br /> "/ubbthreads/images/banners/vixshop.gif","http://www.vixenshop.com", <br /> "/ubbthreads/images/banners/giger.jpg","http://www.giger.com/mainflash.htm", <br /> "/ubbthreads/images/banners/projectpitchfork.jpg","http://www.pitchfork.de/page_en.php?", <br /> "/ubbthreads/images/happyhalloween.gif","http://emeraldforestseattle.com"); <br /> <br /> var ad_num = getAdNum(); <br /> document.write('&lt;CENTER&gt;&lt;TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0&gt;&lt;TR&gt;&lt;TD ' <br /> +'ALIGN=CENTER&gt;'+'&lt;/TD&gt;&lt;TR&gt;&lt;/TR&gt;&lt;TD&gt;&lt;A HREF="'+ads[ad_num].href+'"&gt;&lt;IMG SRC="'+ads[ad_num].src+'" ' <br /> +'WIDTH="468" HEIGHT="60" BORDER=0 name=js_ad&gt;&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/CENTER&gt;'); <br /> link_num = document.links.length-1; <br /> function rotateSponsor() { <br />  if (document.images) { <br />   ad_num = (ad_num+1)%ads.length; <br />   document.js_ad.src = ads[ad_num].src; <br />   document.links[link_num].href = ads[ad_num].href; <br />   setTimeout("rotateSponsor()",60000); <br />  } <br /> } <br /> setTimeout("rotateSponsor()",60000); <br /> // --&gt; <br /> &lt;/script&gt;  
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
#281036 - 10/26/04 03:41 PM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: smoknz28]
ChAoS_dup1 Offline
Code Monkey

Registered: 11/15/02
Posts: 576
Loc: Great Northwest
So what do you think of the latter? Would it be usefull or just a matter of preference?
_________________________
ChAoS
Emerald Forest Gaming Servers
Official STFU Thread


Top
#281037 - 10/26/04 03:54 PM Re: Finished-[All] Multiple Random Banners (No Duplicates) [Re: barbiro]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
[]ChAoS said: <br />So what do you think of the latter? Would it be usefull or just a matter of preference? [/] <br /> <br />Well it's just not the best way to go about it even if you could get it running perfectly. More inefficient compared to doing it client-side which is designed for this kind of thing :-) <br /> <br />PS - I added a tweak to the Javascript so that it no longer always starts cycling on the 1st image after a refresh, but rather chooses one randomly now and then cycles in order from there. This helps to ensure better coverage of the group.
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
Page 2 of 2 < 1 2


Moderator:  Ian_W 
Who's Online
0 registered (), 22 Guests and 11 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Forum 'Trader Ratings'.
by blaaskaak
Yesterday at 08:27 AM
Problems reading a lot of old posts here
by Ruben Rocha
11/18/08 04:33 PM
PhotoPost BB Code Popup
by Iann128
11/15/08 01:24 PM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
Looking for a simple upload script
by AllenAyres
11/11/08 02:12 PM
New Mods
Forum 'Trader Ratings'.
by McLemore
11/19/08 02:14 PM
[7.4] Keep log of custom title changes
by blaaskaak
10/27/08 07:51 AM
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Newest Members
Begbie, cenk, MATTO, DougMMcts, tim Anderson
13361 Registered Users
Top Posters
AllenAyres 25448
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks