Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
5 registered (Gizmo, GregK, Iann128, SteveS, SD), 34 Guests and 16 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 04/22/10
Posts: 5
Top Posters (30 Days)
Ruben 61
SD 52
Gizmo 48
gliderdad 33
Dunny 21
driv 18
dbremer 16
Mark S 13
Stan 12
Iann128 10
Latest Photos
OK Corral Shoot Out
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Page 1 of 3 1 2 3 >
Topic Options
#235139 - 02/25/10 06:56 PM Custom Island - Banner rotation Code
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
This is what I have inserted into Custom Island, using this ad Ad Island.

Quote:
/* PHP CODE HERE */

/* BODY HERE */
$body =
$bannerAd[1] = 'http://www.germanshepherdhome.net/testadbanner1.jpg';
$bannerAd[2] = 'http://www.germanshepherdhome.net/testadbanner2.jpg';
$bannerAd[3] = 'http://www.germanshepherdhome.net/testadbanner3.jpg';

$adCount = count($bannerAd);
$randomAdNumber = mt_rand(1, $adCount);
echo $bannerAd[$randomAdNumber];
<<<EOF
EOF;


So that shows up is just the url


What did I do wrong??? Some day I will learn php

Val
_________________________
http://germanshepherdhome.net
Top
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
#235140 - 02/25/10 07:15 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
gliderdad Offline
Registered: 06/08/06
Posts: 1438
Loc: NY
You need to put the code between the

<<<EOF

EOF;

So you should be

Code:
/* PHP CODE HERE */
$body = <<<EOF

$bannerAd[1] = 'http://www.germanshepherdhome.net/testadbanner1.jpg';
$bannerAd[2] = 'http://www.germanshepherdhome.net/testadbanner2.jpg';
$bannerAd[3] = 'http://www.germanshepherdhome.net/testadbanner3.jpg';

$adCount = count($bannerAd);
$randomAdNumber = mt_rand(1, $adCount);
echo $bannerAd[$randomAdNumber];
EOF;
Top
#235141 - 02/25/10 07:27 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
Php Code:
/* PHP CODE HERE */

$Ads = array (
	'http://www.germanshepherdhome.net/testadbanner1.jpg',
	'http://www.germanshepherdhome.net/testadbanner2.jpg',
	'http://www.germanshepherdhome.net/testadbanner3.jpg'
	);


/* BODY HERE */
$body = <<<EOF
 $Ads[mt_rand(0, count($Ads)-1)]
EOF; 


might work

Remember array index starts from 0 there wink

Also, i'd recommend (if i were you) to put your banners in something like /forums/images/banners directory. That way you don't clutter up your site's root dir.. if you do, you'd need to modify the URLs above, but you get the drift smile
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235142 - 02/25/10 08:25 PM Re: Custom Island - Banner rotation Code [Re: SD]
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
SD,

I did copy and paste on your code got this error

Quote:
Parse error: parse error, unexpected $ in /home/content/t/i/g/tiger2/html/germanshepherdhome/forum/cache_builders/custom/portal_box_1.php on line 16
_________________________
http://germanshepherdhome.net
Top
#235143 - 02/25/10 08:28 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
Gliderdad, I copied and pasted the code you posted and all I get the Island box is

Quote:
= 'http://www.germanshepherdhome.net/testadbanner1.jpg'; = 'http://www.germanshepherdhome.net/testadbanner2.jpg'; = 'http://www.germanshepherdhome.net/testadbanner3.jpg'; = count(); = mt_rand(1, ); echo ;
_________________________
http://germanshepherdhome.net
Top
#235144 - 02/25/10 08:42 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
yah, i left off a ')'

updated the post now..

i keep forgetting to match the number of ('s to )'s and arrays use [] too! laugh
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235145 - 02/25/10 08:50 PM Re: Custom Island - Banner rotation Code [Re: SD]
gliderdad Offline
Registered: 06/08/06
Posts: 1438
Loc: NY
SD's is correct not mine, forgot to move the php to where it should be
Top
#235146 - 02/25/10 08:55 PM Re: Custom Island - Banner rotation Code [Re: gliderdad]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
Custom island syntax has been a bugaboo, because it's not obvious what is php and what is not..

In actuality, the ENTIRE code block is, since the custom island code that UBB.threads uses to save it simply puts <?php and ?> around it.

The only thing you MUST have in your code is the last 3 lines.. where 1 of them assigns to the body a value. the EOF; is key too, since the save code keys upon it.

Linky Poo to a tutorial in progress about how it works.. that one is for a different application of custom island, but the concept remains the same smile
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235147 - 02/25/10 09:38 PM Re: Custom Island - Banner rotation Code [Re: SD]
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
SD,

Another error message
Quote:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/content/t/i/g/tiger2/html/germanshepherdhome/forum/cache_builders/custom/portal_box_1.php on line 13
_________________________
http://germanshepherdhome.net
Top
#235149 - 02/25/10 10:05 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
Php Code:
# Le Pee H Pee
$Ads = array (
	"http://www.germanshepherdhome.net/testadbanner1.jpg",
	"http://www.germanshepherdhome.net/testadbanner2.jpg",
	"http://www.germanshepherdhome.net/testadbanner3.jpg"
	);

$adNum = mt_rand(0, count($Ads)-1);

# The body!
$body = <<<EOF
 <img src="{$Ads[$adNum]}" />
EOF; 


Try that. I typed it up too quick smile

I put it on my test site for you to see Linky Dinky
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235150 - 02/25/10 10:40 PM Re: Custom Island - Banner rotation Code [Re: SD]
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
SD, another error

Quote:
Parse error: parse error, unexpected $ in /home/content/t/i/g/tiger2/html/germanshepherdhome/forum/cache_builders/custom/portal_box_1.php on line 16
_________________________
http://germanshepherdhome.net
Top
#235151 - 02/25/10 10:46 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
make sure there is no SPACE after the EOF; or the <<<EOF lines..

heredoc format is picky that way.. Read their warning in red down the page

i have the code i just posted above you running on my site, so it's gotta be something obscure like that.. smile
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235157 - 02/26/10 09:40 AM Re: Custom Island - Banner rotation Code [Re: Jacque Heebner]
Wisc.Tiger Offline
journeyman
Registered: 07/30/07
Posts: 93
Loc: WI
SD, it was a space at the end of EOF;

Next problem, the banners do not rotate?
_________________________
http://germanshepherdhome.net
Top
#235161 - 02/26/10 12:07 PM Re: Custom Island - Banner rotation Code [Re: Wisc.Tiger]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
well... you have the custom island is built every xx minutes.. that is when it will randomize..

for test.. have it always build and see if it changes..

as for rotation... if you mean you want the banners to sit there and rotate between the 3 every say 30secs.. that's a javascript dealio and is possible wink
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235162 - 02/26/10 12:54 PM Re: Custom Island - Banner rotation Code [Re: SD]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
I have had problems with some not all rotating banner scripts in Islands.
Where they will rotate on the island cache or rotate on the own setting. But only one time. Unless you refresh the browser.
Then it will only make one pass again.
Never figured out why.

BTW, The note on the cache time for a island suggests 0 for banner ad's but it never made a difference in my situation.
_________________________
Blue Man Group
Top
#235163 - 02/26/10 01:43 PM Re: Custom Island - Banner rotation Code [Re: Ruben]
SD Online   partay
Registered: 04/19/07
Posts: 4031
Loc: SoCal, USA
i'd suggest really making the Client browser do the rotation with javascript..

it's really simple and then you only build the island ONE time.. less server resources.

i might slap a quickie tutorial together on it smile
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#235184 - 02/26/10 08:14 PM Re: Custom Island - Banner rotation Code [Re: SD]
cascadeclimbers Offline

member
Registered: 06/02/04
Posts: 186
Loc: Seattle, WA
I had a PHP/MySQL script that would never want to rebuild every time when things were set to zero that was linked to an affiliate app.

I was looking at doing something similar with rotating pictures and came across this jQuery plugin.

http://malsup.com/jquery/cycle/

For a good implementation of it go to arstechnica.com and look at the right for the their featured articles box.
_________________________
Won't you take me to Funkytown?
Top
#237157 - 06/03/10 01:03 PM Re: Custom Island - Banner rotation Code [Re: cascadeclimbers]
markpogi Offline
stranger
Registered: 05/09/10
Posts: 16
I am looking to put up banner adds between threads 1 and 2 and it would rotate every time they click, how do i do that in islands
Top
#237189 - 06/04/10 02:46 PM Re: Custom Island - Banner rotation Code [Re: markpogi]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
I guess it depends on what type of banner you wish to use.
For something like google ads just place the script between the eof tags.

So I guess the real question is what banner script are you contemplating on using.
_________________________
Blue Man Group
Top
#237274 - 06/06/10 12:37 PM Re: Custom Island - Banner rotation Code [Re: Ruben]
markpogi Offline
stranger
Registered: 05/09/10
Posts: 16
what is easiest ? i was told java script, where do i put the banners in on the server.
Top
#237276 - 06/06/10 12:48 PM Re: Custom Island - Banner rotation Code [Re: markpogi]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
Don't quite understand the question but...
The script would go in the island.
If you have say some image files for the banner put them where ever you want.Then reference them in the script.
if it is a php script then you would place the php code between the comments in the island code.

It might be a better starting point with posting a banner ad you like and we all can make suggestions.
_________________________
Blue Man Group
Top
#237416 - 06/11/10 09:30 AM Re: Custom Island - Banner rotation Code [Re: markpogi]
markpogi Offline
stranger
Registered: 05/09/10
Posts: 16
this is the kind i like to add
Top
#237554 - 06/21/10 03:54 AM Re: Custom Island - Banner rotation Code [Re: markpogi]
markpogi Offline
stranger
Registered: 05/09/10
Posts: 16
/* PHP CODE HERE */
# Le Pee H Pee
$Ads = array (
"http://www.asiabarhop.com/banners/LOLLIPOP1.jpg",
"http://www.asiabarhop.com/banners/lb_banner13.jpg",
"http://www.asiabarhop.com/banners/tequilareef_ad_468.jpg"
);

$adNum = mt_rand(0, count($Ads)-1);

# The body!
$body = <<<EOF
<img src="{$Ads[$adNum]}" />
EOF;


What am i doing wrong?????? am i not enabling it in ubb? i have enableled all that i can see to do
Top
#237555 - 06/21/10 10:32 AM Re: Custom Island - Banner rotation Code [Re: markpogi]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
Loc: Aberdeen, WA
Hmm, that looks proper. You should now just be able to go into portal layout and choose where you want it to display.
Top
#237556 - 06/21/10 02:09 PM Re: Custom Island - Banner rotation Code [Re: Rick]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
I checked the links for your banners the 2nd one
http://www.asiabarhop.com/banners/lb_banner13.jpg
Does not exist I get a file not found.
_________________________
Blue Man Group
Top
#237592 - 06/24/10 12:41 PM Re: Custom Island - Banner rotation Code [Re: Rick]
markpogi Offline
stranger
Registered: 05/09/10
Posts: 16
Originally Posted By: Rick
Hmm, that looks proper. You should now just be able to go into portal layout and choose where you want it to display.


i don't want it to go on lt side or rt side i want it to go between 1 & 2 post in forums

I removed the one banner that's why the one does not work
Top
#237596 - 06/24/10 04:44 PM Re: Custom Island - Banner rotation Code [Re: markpogi]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
You have to make it a custom island first.
Then you would add the island at
Control Panel » Forum Settings » Edit Forum
TAB>Custom inserts.
Select the island from the list in the
Custom Island Insert field.
_________________________
Blue Man Group
Top
#237597 - 06/24/10 04:48 PM Re: Custom Island - Banner rotation Code [Re: Ruben]
Ruben Offline

Registered: 12/20/03
Posts: 4268
Loc: Lutz,FL
Oh forgot about this part.
After you do the above.
You need to make the groups see it by going to:
Control Panel » Forum Permissions
Must view Ad Island
Set a 1 in each group you want to make it visible to.
_________________________
Blue Man Group
Top
Page 1 of 3 1 2 3 >



Moderator:  AllenAyres, Harold, Ian, Ron M 
Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Edit Post
by Bert
Today at 01:19 PM
A positive note
by SteveS
Yesterday at 09:36 PM
How to locate links to particular site if they are only used in images?
by Conrad
02/10/12 09:41 PM
Pictures not displaying
by Marker23
02/09/12 10:04 PM
Issue with logging out constantly
by Flanuva
02/09/12 07:05 PM
Forum Stats
10214 Members
36 Forums
33668 Topics
180918 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image