|
 |
|
Codewalkers Forums
> PHP Related
> PHP Coding
|
How do I create a custom banner display script?
Discuss How do I create a custom banner display script? in the PHP Coding forum on Codewalkers. How do I create a custom banner display script? Having problems with a PHP script you are coding? This is the place to get help!
|
|
|
|
 |
|
|
|
|

Codewalkers Forums Sponsor:
|
|
|

November 5th, 2012, 06:33 AM
|
|
Contributing User
|
|
Join Date: Jul 2008
Posts: 77
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 5
|
|
How do I create a custom banner display script?
Hi guys,
I hardly know (or even understand) PHP, so that's why I am posting this in the 'noob'-section. Hopefully someone is friendly enough to help me out.
How do I do the following. I want to show a banner on my website, however not in a static position. And it should only be displayed once.
For example; I have 3 available positions on my website, where I want to display a banner. I have 2 available positions in the main page (top and bottom) and 1 available position on the right side of my website.
Now I need something which does the following; if the banner is shown on position 1 (top of the page) it shouldn't be displayed in position 2 or 3. On the other hand, if the banner is being displayed at position 3 (right side), it shouldn't be displayed anymore in position 1 or 2.
Oh and more thing; position 1 and 2 have the same banner (in dimensions), however position 3 has a smaller banner (in dimensions). So the banner which is displayed at position 3 is different compared to positions 1 and 2.
Can someone please help me out with this? I think it's not difficult for someone who actually knows PHP (unlike me).
I already tried searching on Google, however I couldn't find anything on it (or I am searching in an incorrect way).
Thank you in advance for your help!! Highly appreciated!!
//update
Forgot to mention this; it should be possible to expand this to several more banner-sections and banner formats.
Last edited by HHawk : November 5th, 2012 at 06:38 AM.
|

November 5th, 2012, 06:37 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
|
well you could create a random variable which is 1,2 or 3 as a value.
1 = top
2 = bottom
3 = right
and assign each of them a dimension for size.
when the page loads, randomly select a position, and based on that value, you have the dimension?
__________________
When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
|

November 5th, 2012, 06:38 AM
|
|
Contributing User
|
|
Join Date: Jul 2008
Posts: 77
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 5
|
|
Quote: | Originally Posted by DavidMR well you could create a random variable which is 1,2 or 3 as a value.
1 = top
2 = bottom
3 = right
and assign each of them a dimension for size.
when the page loads, randomly select a position, and based on that value, you have the dimension? |
Thanks for the reply, but how do I do this?
|

November 5th, 2012, 06:48 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
well in php, the rand function works like this:
this gives you a random number between 1 and 3.
in your php source, you could hardcode the dimensions:
PHP Code:
if ($banner == '1') $dimension = '200x50';
for example.
|

November 5th, 2012, 06:58 AM
|
|
Contributing User
|
|
Join Date: Jul 2008
Posts: 77
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 5
|
|
Thanks for the quick response.
So if I would use this (for example):
PHP Code:
<?php
$banner = rand(1, 3);
if ($banner == '1') $dimension = '200x50';
if ($banner == '2') $dimension = '200x50';
if ($banner == '3') $dimension = '200x50';
print $banner;
It should work? And how does it know in what position it has to place the banner? Doesn't really look like a workable solution, but like I said I don't know much about PHP.
|

November 5th, 2012, 08:28 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
|
well i only quoted the dimensions as an example, the actual dimensions would be determined by whether or not it would be top/bottom/right. You would probably need to identify the banner dimensions before hand.
"200x50" doesnt mean anything unless its being used in context.
|

November 5th, 2012, 08:31 AM
|
|
Contributing User
|
|
Join Date: Jul 2008
Posts: 77
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 5
|
|
Quote: | Originally Posted by DavidMR well i only quoted the dimensions as an example, the actual dimensions would be determined by whether or not it would be top/bottom/right. You would probably need to identify the banner dimensions before hand.
"200x50" doesnt mean anything unless its being used in context. |
Thanks.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|