|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
This is what I have inserted into Custom Island, using this ad Ad Island. /* 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
|
|
|
|
Joined: Jun 2006
Posts: 1,344
veteran
|
veteran
Joined: Jun 2006
Posts: 1,344 |
You need to put the code between the <<<EOF EOF; So you should be
/* 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;
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
$Ads = array (
'http://www.germanshepherdhome.net/testadbanner1.jpg',
'http://www.germanshepherdhome.net/testadbanner2.jpg',
'http://www.germanshepherdhome.net/testadbanner3.jpg'
);
$body = <<<EOF
$Ads[mt_rand(0, count($Ads)-1)]
EOF;
might work Remember array index starts from 0 there  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 
|
|
|
|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
SD, I did copy and paste on your code got this error 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
|
|
|
|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
Gliderdad, I copied and pasted the code you posted and all I get the Island box is = 'http://www.germanshepherdhome.net/testadbanner1.jpg'; = 'http://www.germanshepherdhome.net/testadbanner2.jpg'; = 'http://www.germanshepherdhome.net/testadbanner3.jpg'; = count(); = mt_rand(1, ); echo ;
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
yah, i left off a ')' updated the post now.. i keep forgetting to match the number of ('s to )'s and arrays use [] too! 
|
|
|
|
Joined: Jun 2006
Posts: 1,344
veteran
|
veteran
Joined: Jun 2006
Posts: 1,344 |
SD's is correct not mine, forgot to move the php to where it should be
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
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 
|
|
|
|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
SD, Another error message 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
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
$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);
$body = <<<EOF
<img src="{$Ads[$adNum]}" />
EOF;
Try that. I typed it up too quick  I put it on my test site for you to see Linky Dinky
|
|
|
|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
SD, another error 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
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
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.. 
|
|
|
|
Joined: Jul 2007
Posts: 91
journeyman
|
journeyman
Joined: Jul 2007
Posts: 91 |
SD, it was a space at the end of EOF;
Next problem, the banners do not rotate?
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
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 
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
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 There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
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 
|
|
|
|
Joined: Jun 2004
Posts: 207
enthusiast
|
enthusiast
Joined: Jun 2004
Posts: 207 |
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?
|
|
|
|
Joined: May 2010
Posts: 16
stranger
|
stranger
Joined: May 2010
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
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
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 There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: May 2010
Posts: 16
stranger
|
stranger
Joined: May 2010
Posts: 16 |
what is easiest ? i was told java script, where do i put the banners in on the server.
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
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 There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: May 2010
Posts: 16
stranger
|
stranger
Joined: May 2010
Posts: 16 |
this is the kind i like to add
|
|
|
|
Joined: May 2010
Posts: 16
stranger
|
stranger
Joined: May 2010
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
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Hmm, that looks proper. You should now just be able to go into portal layout and choose where you want it to display.
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
I checked the links for your banners the 2nd one http://www.asiabarhop.com/banners/lb_banner13.jpgDoes not exist I get a file not found.
Blue Man Group There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: May 2010
Posts: 16
stranger
|
stranger
Joined: May 2010
Posts: 16 |
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
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
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 There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Dec 2003
Posts: 6,633 Likes: 85
|
Joined: Dec 2003
Posts: 6,633 Likes: 85 |
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 There is no such thing as stupid questions. Just stupid answers
|
|
|
1 members (Conrad),
162
guests, and
177
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|