PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old November 5th, 2012, 06:33 AM
HHawk HHawk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 77 HHawk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 6
Arrow 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.

Reply With Quote
Old November 5th, 2012, 06:37 AM
DavidMR's Avatar
DavidMR DavidMR is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Galway
Posts: 1,439 DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Month 3 Days 20 h 47 m 34 sec
Reputation Power: 9
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.

Reply With Quote
Old November 5th, 2012, 06:38 AM
HHawk HHawk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 77 HHawk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 6
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?

Reply With Quote
Old November 5th, 2012, 06:48 AM
DavidMR's Avatar
DavidMR DavidMR is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Galway
Posts: 1,439 DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Month 3 Days 20 h 47 m 34 sec
Reputation Power: 9
well in php, the rand function works like this:

PHP Code:
 $banner =  rand(13); 


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.

Reply With Quote
Old November 5th, 2012, 06:58 AM
HHawk HHawk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 77 HHawk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 6
Thanks for the quick response.

So if I would use this (for example):

PHP Code:
<?php
$banner 
=  rand(13);
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.

Reply With Quote
Old November 5th, 2012, 08:28 AM
DavidMR's Avatar
DavidMR DavidMR is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Galway
Posts: 1,439 DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Month 3 Days 20 h 47 m 34 sec
Reputation Power: 9
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.

Reply With Quote
Old November 5th, 2012, 08:31 AM
HHawk HHawk is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 77 HHawk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 48 m 15 sec
Reputation Power: 6
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.

Reply With Quote
Closed Thread

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > How do I create a custom banner display script?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap