- OpenX Community Forums
![]() ![]() |
Aug 12 2005, 12:24 AM
Post
#1
|
|
|
Beginner ![]() Group: Members Posts: 6 Joined: 12-August 05 Member No.: 6,846 |
I want to display randomly different size ads in a column. I want to be able to pull either 4 randomly picked 120x60 ads or one 120x240 ad. Is there a way to do this?
Thanks |
|
|
|
Aug 12 2005, 05:20 AM
Post
#2
|
|
|
Member ![]() ![]() Group: Members Posts: 28 Joined: 14-April 05 Member No.: 5,178 |
Use " x " as zone size.
This will allow to show different size banners on that zone. |
|
|
|
Aug 12 2005, 05:30 PM
Post
#3
|
|
|
Beginner ![]() Group: Members Posts: 6 Joined: 12-August 05 Member No.: 6,846 |
Yes, using "*" will show different sizes in the zone sizes for width and height. But I'm trying to have an area 120 wide by 240 high which can be filled by either 4 randomly picked 120x60 or one 120x240 ad.
So far I have been putting 4 120x60 ads by coping the invocation code 4 times with the "do not repeat ad on same page". This places 4 randomly picked ads and fills the 120x240 space, however I want to sometimes show a 120x240 ad instead of the 4 120x60 ads. When I put "*" in the height field to include the 120x240, I get sometime 3 120x60 ads and one 120x240 ad, making the total hight 420 instead of 240. I hope this makes more sense. Thanks. |
|
|
|
Aug 12 2005, 05:53 PM
Post
#4
|
|
|
Member ![]() ![]() Group: Members Posts: 28 Joined: 14-April 05 Member No.: 5,178 |
Hi leefs,
This can be done using HTML Banner Invocation but iam not very much sure of this you may consult Goleyc regarding this, he will give the exact solution. Try sending him a request. |
|
|
|
Aug 12 2005, 06:30 PM
Post
#5
|
|
![]() Mentor ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,130 Joined: 24-October 03 From: Ohio Member No.: 419 |
QUOTE (adconfig @ Aug 12 2005, 12:53 PM) Hi leefs, This can be done using HTML Banner Invocation but iam not very much sure of this you may consult Goleyc regarding this, he will give the exact solution. Try sending him a request. Actually, do not send me a request! The solution requires several invocation codes to be grouped together under 1 campaign. I wrote about this somewhere on here and posted a somewhat crazy answer. If you search by my username, you should be able to find it. |
|
|
|
Aug 12 2005, 09:13 PM
Post
#6
|
|
|
Beginner ![]() Group: Members Posts: 6 Joined: 12-August 05 Member No.: 6,846 |
This is what I have done so far:
1) Created 4 120x60 ads 2) Created a zone, and linked the ads to the zone (this can be done directly, or via a campaign - it doesn't matter). 3) Created the zone invocation code as a JavaScript tag, and select the "Don't show the banner again on the same page". 4) Cut and Pasted invocation code 4x into new HTML banner. 5) Created a NEW zone, and linked the combined 4 120x60 ads and the 120x240 ads. 6) Then created the invocation code for the new zone, and put the new code into web site. This now works. It shows either 4 randomly picked 120x60 ads or one 120x240 ad. However, the JavaScript I think is slowing the loading time by about ~4x compared to when the 4 120x60 ads were loaded by themselves. So I tried to make the first invocation code with the local (PHP code). I then cut and paste the PHP code into the HTML banner (step 4 above) however the php is not working. I have allowed php expressions in the admin, but the php is not executing. This is the php code: CODE <? if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:2', 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } ?> and this is what I get: 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } ?> Any help would be great! |
|
|
|
Aug 22 2005, 09:47 PM
Post
#7
|
|
|
Beginner ![]() Group: Members Posts: 6 Joined: 12-August 05 Member No.: 6,846 |
Got it to work now. Thanks for your help!!
|
|
|
|
Aug 23 2005, 04:24 AM
Post
#8
|
|
|
Beginner ![]() Group: Members Posts: 8 Joined: 29-June 05 Member No.: 6,203 |
Hi,
Could you please post the methods you have used to make it works? |
|
|
|
Aug 24 2005, 01:36 AM
Post
#9
|
|
|
Beginner ![]() Group: Members Posts: 6 Joined: 12-August 05 Member No.: 6,846 |
I am by far a newbie with phpAdsNew and with php, but I got something to work. Don't know how bad a hack it is. I decribed the process above. I ended up with the following invocation code (with some modifications):
CODE <? if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ($adDescp, 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html'].'<br><br>'; } if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ($adDescp, 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html'].'<br><br>'; } if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ($adDescp, 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html'].'<br><br>'; } if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ($adDescp, 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html'].'<br><br>'; } if (@include(getenv('DOCUMENT_ROOT').'/ads/data/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ($adDescp, 0, '_blank', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html'].'<br><br>'; } ?> I use the $adDescp variable to include which banner criteria I want to show each page. Hope this helps you. |
|
|
|
Sep 15 2005, 04:11 PM
Post
#10
|
|
|
Beginner ![]() Group: Members Posts: 2 Joined: 27-May 05 Member No.: 5,762 |
QUOTE (leefs @ Aug 24 2005, 01:36 AM) I use the $adDescp variable to include which banner criteria I want to show each page. Can you give an example of one of you $adDescp variables? Did you use sizing parameters by chance (width and/or height)? |
|
|
|
Nov 1 2005, 05:38 PM
Post
#11
|
|
|
Member ![]() ![]() Group: Members Posts: 24 Joined: 8-June 04 Member No.: 2,194 |
Hi. I just came here looking to find out how to do a very similar thing.
I usually show three small banners in a column on the right side of my site. But I'd like add a long skinny banner size and have phpAdsNew statistically decide to show either the multiple smaller banners OR show the one long banner. I'm having a little trouble following this thread. Has anyone figured this out and if so can you share some details? |
|
|
|
Nov 1 2005, 08:29 PM
Post
#12
|
|
|
Member ![]() ![]() Group: Members Posts: 24 Joined: 8-June 04 Member No.: 2,194 |
Hmmm... I just came up with a solution which appears to work! Can some of you PAN gurus tell me if this is safe to do or not?
For the purposes of this example assume you would want to randomly show EITHER four 125x125 banners in a column OR a one 120x600 banner. 1. Create three zones that are set to show only 125x125 banners and link all your 125x125 banners to these three zones. 2. Create another zone that does not have a banner size set for it by putting * in the size fields. I called this zone My Not-Size-Specific Zone. Link your 125x125 and your 120x600 banners to this zone. 3. Generate the normal local mode invocation code for this My Not-Size-Specific Zone. 4. Place the invocation code for My Not-Size-Specific Zone in your web page and immediately following this put: CODE if ( $phpAds_raw['height'] == 125 && $phpAds_raw['width'] == 125 ) { ...invocation code for a strictly 125x125 banner zone #1 ...invocation code for a strictly 125x125 banner zone #2 ...invocation code for a strictly 125x125 banner zone #3 } So basically what it does it it chooses to show either a 125x125 or a 120x600 banner. Then you check to see what the size of the banner is that it chose. And based on that you either do or do not tell it to show three more banners. Does this seem like a safe thing to do? Or will it throw off PAN's statistics? |
|
|
|
Nov 1 2006, 10:53 AM
Post
#13
|
|
|
Beginner ![]() Group: Members Posts: 3 Joined: 1-November 06 Member No.: 13,529 |
Hey guys,
Thanks for the information. What about putting 4 days side by side on one ROW instead of a column? Can this also be done? It seems that the codes mentioned show them on a column instead. What I would like to do is put one banner next to another side by side. Example, one Google Adsense banner with just text, next to an affiliate banner that has an image. Thanks, Binh |
|
|
|
Dec 14 2006, 10:42 PM
Post
#14
|
|
|
Beginner ![]() Group: Members Posts: 2 Joined: 14-December 06 Member No.: 14,742 |
Hmmm... I just came up with a solution which appears to work! Can some of you PAN gurus tell me if this is safe to do or not? Thanks ldk for the help!To clarify, because it took me some time to figure out what ldk was saying, this is what you need to do: In order to display for example, two small banners side by side (176width) OR one large banner (368width), you first invoke a banner via direct select: CODE if (@include('/var/www/html/phpads/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('directselect', 0, '', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } This is using the direct select method of invoking a banner by using keywords. In this case the keyword I am filtering by is "directselect". You add keywords to individual banners under campaigns in order for them to show up using this method. After you invoke the banner, you are going to find out whether the banner was the large one, or a small one, by doing this: CODE if ($phpAds_raw['width'] == 176 ) { This variable was declared earlier when invoked the first banner. Now, if the large banner was invoked, nothing happens. If the small banner was invoked, you will want to invoke another banner to put right next to the first one. However, you must make sure you invoke a small banner, and not another large banner, so we will need to add another keyword: CODE if (@include('/var/www/html/phpads/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('directselect/small', 0, '', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } You will notice I added a forward slash and the word "small" to invoke another small banner. This method works great and I believe that statistics will work fine when invoking banners this way. This is the full code: CODE <?php
if (@include('/var/www/html/phpads/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('directselect', 0, '', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } if ($phpAds_raw['width'] == 176 ) { echo " "; if (@include('/var/www/html/phpads/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('directselect/small', 0, '', '', '0', $phpAds_context); $phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']); echo $phpAds_raw['html']; } } ?> |
|
|
|
![]() ![]() |