1
Gombunan
AdSense ads in news module
  • 2007/3/16 17:56

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Hello,

I am trying to ad AdSense ads into my news module. The ad should float on the left side and the article wraps around it.

I've actually done this before but I can seem to figure out what I did to make it work.

At the moment I tried editing the templates news_item.html and add the following code

<div style="width: 300px;float: left; margin: 0px 19px 5px 1px;">
My AdSense code
</div>


the final template looks like

<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><div class="itemBody"><{$story.imglink}><class="itemText">

<
div style="width: 300px;float: left; margin: 0px 19px 5px 1px;">
My AdSense code

</div>

<{
$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>


I tried updating via the preference section, deleted files in templates_c folder but the changes were not added.

What am I missing here?

2
JMorris
Re: AdSense ads in news module
  • 2007/3/16 18:52

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


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
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.

3
davidl2
Re: AdSense ads in news module
  • 2007/3/16 18:53

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


In actual fact, I'm currently helping test a new piece of code from the SmartFactory which makes adding Adsense adverts ANYWHERE on a XOOPS site very easy!

I'm unsure of the release date, but this should be in the near future.

(In fact, it's already up-and-running at www.smartfactory.ca )

4
Gombunan
Re: AdSense ads in news module
  • 2007/3/17 16:12

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Thanks for the reply.

Problem is, the AdSense code does not even appear in the source code of the page.

Any changes I made to the news_item.html isn't included in the news section.

5
Gombunan
Re: AdSense ads in news module
  • 2007/3/17 16:13

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Sounds good to me. Looking forward to the official release

6
Gombunan
Re: AdSense ads in news module
  • 2007/3/19 11:29

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Quote:

Gombunan wrote:
Thanks for the reply.

Problem is, the AdSense code does not even appear in the source code of the page.

Any changes I made to the news_item.html isn't included in the news section.


BTW, anybody can suggest how to fix the problem I am having above?

Thanks

7
JMorris
Re: AdSense ads in news module
  • 2007/3/19 20:53

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Sounds like the template set you are editing is not set as the default. Either that, or you need to clear the contents of the templates_c/ directory.
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.

8
Gombunan
Re: AdSense ads in news module
  • 2007/3/19 23:49

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


Quote:

JMorris wrote:
Sounds like the template set you are editing is not set as the default. Either that, or you need to clear the contents of the templates_c/ directory.


news_item.html is the default template and I've been clearing the templates_c directory. But nothing happens.

9
JMorris
Re: AdSense ads in news module
  • 2007/3/19 23:56

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


I think you misunderstood my meaning...

Did you clone the default template set and set your new "cloned" template set as the default in your preferences?

~OR~

Are you editing the default template set files directly on the server and expecting the changes to be made?

If you are doing 2, that's a really bad idea. You should always clone your default template set and work on your custom template set so you have a fall-back in case of an emergency. Also, you won't see the changes unless you go into the Modules admin and update the module.

Hope that helps.

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.

10
Gombunan
Re: AdSense ads in news module
  • 2007/3/20 17:02

  • Gombunan

  • Just popping in

  • Posts: 30

  • Since: 2005/5/14


You are right. I shouldn't have edited the template set files directly on the server.

That's what I did. But the template should've been updated anyway after I went to the Module admin and update the module right? But it didn't.

Anyway I follow your the first suggestion and it fixed the problem. Thank you!

Login

Who's Online

168 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 168


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