11
JMorris
Re: AdSense ads in news module
  • 2007/3/20 17:08

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


No problem!

I use to do things like that too. Time and bad experiences have taught me better.

RE: Updating the module didn't update the templates. If they are cached, you might get that result.
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

12
Gombunan
Re: AdSense ads in news module
  • 2007/3/20 18:02

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Hi JMorris,

I have another question if you don't mind.

I tried your suggestion below but my AdSense code is still being generated on the news/index.php page

Quote:

JMorris wrote:
2 things...

1. If you don't qualify that you only want the article to be displayed on the full article page, you'll violate Google's terms of only displaying 3 ad blocks on a page. The same template that is used for the full article page is used for the module index.

Here's the code I'm using on one of my sites.

<table cellpadding="0" cellspacing="0" class="item">
<
tr>
    <
td>
        <
table cellpadding="0" cellspacing="0" width="98%">
        <
tr>
            <
td class="itemHead"><span class="itemTitle"><{$story.title}></span></td>
        </
tr>
        <
tr>
            <
td class="itemInfo"><{if $story.files_attached}><{$story.attached_link}>&nbsp;<{/if}><{if $story.poster != ''}><span class="itemPoster"><{$lang_postedby}> <{$story.poster}></span><{/if}> <span class="itemPostDate"><{$lang_on}> <{$story.posttime}></span> (<span class="itemStats"><{$story.hits}> <{$lang_reads}></span>) <{$news_by_the_same_author_link}></td>
        </
tr>
        <
tr>
            <
td>[b]<{if $SCRIPT_NAME != '/modules/news/index.php'}><div class="gads"><!--My Adsense Code--></div><{/if}>[/b]<div class="itemBody"><{$story.imglink}><class="itemText"><{$story.text}></p></div></td>
        </
tr>
        <
tr>
            <
td class="itemFoot"><span class="itemAdminLink"><{$story.adminlink}></span><{if $rates}><b><{$lang_ratingc}></b> <{$story.rating}> (<{$story.votes}>) - <a href="<{$xoops_url}>/modules/news/ratenews.php?storyid=<{$story.id}>" rel="nofollow"><{$lang_ratethisnews}></a> - <{/if}><span class="itemPermaLink"><{$story.morelink}></span></td>
        </
tr>
        </
table>
    </
td>
</
tr>
</
table>


Instead of putting the CSS inline, I did class="gads" and created the .gads definition in my style.css file.

2. If you're just adding Adsense to your site, it may take a day or two even for the public service ads to show up.

HTH.

James

13
JMorris
Re: AdSense ads in news module
  • 2007/3/20 18:10

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Turn on SMARTY Debug and browse to your News module index. Then look in your SMARTY Debug output for {$SCRIPT_NAME}. Whatever the value is in the Debug is what you need to put in your template. Since your site is in a sub-directory, the path may be different.

I took that code from a site that is in the root of the domain, not a sub-directory.

HTH.

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

Login

Who's Online

132 user(s) are online (63 user(s) are browsing Support Forums)


Members: 0


Guests: 132


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits