Forum Moderators: coopster

Message Too Old, No Replies

2 adsense codes but want to show only one

         

blue_eagle

6:54 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



Hi there,
I use only one adsense block on my pages. My pages are usually in wdget.php - widget-blue.php form and there are links on them to some articles. However, when a person clicks on article link they go to widget.php?showfulli_etc. etc. and since I implemented one more adsense code in my script when a person goes to the article page. They see the adsense codes which is the regular one (the first one on wdiget-blue.php and the one in the script which is the second one. What I want is I don't want to show the first adblock when my visitor goes to the article page (widget.php?showfulletc.) instead i want to show the which i implemented into the script.

I was wondering if there is any script will disable the first one when a visitr goes to the article page and will show only the one which is implmeneted in the script.

Thanks in advance.

Sincerely..

dmorison

7:21 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If i've ready you correctly, there will only be a query string on the URL (the bit after the "?") on your article pages, so you could test for that when decided whether to show the first AdSense codes.

For example, in your widget.php:


<?php
if (!$_SERVER['QUERY_STRING'])
{
// first AdSense code goes here
}

Note the "!" operator - so you're only showing AdSense if there is nothing on the URL after the "?" (the Query String).

blue_eagle

8:21 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



Thank you very much dmorison, I really appreciate. I tried and worked well can you also tell me what should I do to replace another banner instead of the adsense code which disappears on the article page it looks blank and I would like to add some stuff there.

Really appreciated thank you very very much again.

dmorison

8:32 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



what should I do to replace another banner instead of the adsense code which disappears on the article page it looks blank and I would like to add some stuff there.

You can use the same control block where you check for the Query String, and use an "else" statement.

If you are very new to programming and PHP, it will be worth you looking at the following pages of the manual which tell you how to control the flow of your script:

[uk.php.net...]

In this case, you need to use "else"...

[uk.php.net...]

So you have something like:

<?php
if (!$_SERVER['QUERY_STRING'])
{
// first AdSense code goes here
}
else
{
// your other banner for article pages goes here
}