Recent Topics

1 Nov 28, 2005 06:01    

Hello All,
I want to find out a way on how I can configure/edit the skin of the blog so that the GoogleAds/Chitika Ads are displayed either on the centre of the page or after 2-3 blog posts. I have seen it done on other blogs but cannot figure out a way with my very low level skills with PHP :D.

Any directions would be appreciated.

Ask me if the inforamation is not sufficient.

My blogs are at www.softwareandtools.com & www.itejas.com .

Regards,

Tejas Patel

2 Dec 19, 2005 08:09

I had been wondering about this too, and I asked a friend, and he came up with this:

Before the

// ---------------------------------- END OF POSTS ------------------------------------ ?>

line in your skin's _main.php, put the following:

<?php
    if ( ! $shown_advert )
    {
?>

*PUT THE GOOGLEADS CODE HERE*

<?php
      $shown_advert = 1;
    } 

} 

The ads will show up between the first and second posts. For an example of what it looks like, see my blog at http://blog.giantpachinkomachineofdoom.com/

fyi, I used 3 of their 300x250 ad blocks in a row (More ads, and doesn't break resizing.)

I really know nothing about this stuff, but that's what's in my file...so if it doesn't work, I'm not in much of a position to help... ^^;

I'm just totally floored that I have information to offer ;P

3 Dec 19, 2005 12:49

Thanks for your help, that does help. Well appreciated.

So we know it's can be done easily. I wonder if someone can tweak this code to include ads after two posts on the blog?

Tejaaa

4 Dec 19, 2005 13:10

At the top of your skin put :-

$show_advert = 0;

Then change the code to :-

$show_advert++;

if ( $show_advert == 2 ) {
// code to display google ads
}

¥

5 Dec 19, 2005 23:53

¥åßßå, thanks for your help. Although would you please be able to write complete code with brackets and braces. I am no developer and so cannot figure out what is right and what is wrong. I have added "$show_advert = 0; " just below <head> section and the rest of the code is as belows and it does not seem to show the ads. Can you please comment?

<?php 
    if ( $show_advert == 2 )
{

 ?>    
*Google Ads Script*





<?php 
      $show_advert++; 
    } 

}

Regards,

Tejaaa

6 Dec 20, 2005 01:21

Hi Tejaaa,

Based on the code you posted, the only mistake you have is that $show_advert++; is within the braces, it should read more like this

$show_advert++;
if ($show_advert == 2 ) {
// google ads stuff here
}

¥

7 Dec 20, 2005 02:38

Thanks mate, please check your PM.

tejaaa


Form is loading...