1
ps2home
How to insert google adsense in to an article?
  • 2007/3/5 1:57

  • ps2home

  • Just popping in

  • Posts: 1

  • Since: 2007/3/5 1


Hello

I have made an article on my website and wan't to add the google adsense code, when I do this its invisible and won't showup on the page. How do I make it show up, it seems to do this with alot of scripts, they don't show up?

My website is at www.ps2home.co.uk

Many thanks,
PS2home

2
BDW
Re: How to insert google adsense in to an article?
  • 2007/3/7 0:18

  • BDW

  • Quite a regular

  • Posts: 280

  • Since: 2002/9/28


the adsense code works fine on your home page.

Are you trying to add it to your articles in smartsection. If so then make sure HTML is enabled and you post the full code.

3
AndyM
Re: How to insert google adsense in to an article?
  • 2007/3/7 0:36

  • AndyM

  • Quite a regular

  • Posts: 296

  • Since: 2003/8/31


I've come across this problem myself - basically you have to disable auto line breaks and format paragraphs, etc., manually.

4
Stewdio
Re: How to insert google adsense in to an article?
  • 2007/3/7 0:58

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


One solution I can think of, is to insert the code into a new table in the template itself.

This way, for every article or page you right, your ad will be displayed.

A common way I've seen this done is to have it displayed immediately after the spot a user is taken to after they click on more, for instance....


I hope that helps some.
XOOPS Community Support

5
JMorris
Re: How to insert google adsense in to an article?
  • 2007/3/7 1:52

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


With Smartsection, I use the following custom template for the smartsection_item.html template. You can see a live demo HERE

<{include file='db:smartsection_header.html'}> 
<
div class="item"
<{if 
$display_whowhen_link}> 
  <
div class="itemInfo"> <span class="itemPoster"
    <
div class="smartsection_item_head_who"> <{$item.who_when}> (<{$item.counter}> <{$lang_reads}>) </div
    </
span> </div
<{/if}> 
  <
div class="itemBody"
<{if 
$pagenav}> 
    <
div class="smartsection_pagenav_top"><{$lang_page}>: <{$pagenav}></div
<{/if}> 
    <
div class="itemText">
<
div class="gads"><script type="text/javascript"><!--
google_ad_client "pub-5538796211688403";
google_ad_width 336;
google_ad_height 280;
google_ad_format "336x280_as";
google_ad_type "text_image";
//2007-01-23: MyWebResource
google_ad_channel "1050095188";
google_color_border "FFFFFF";
google_color_bg "FFFFFF";
google_color_link "000000";
google_color_text "333333";
google_color_url "777777";
//--></script>
<script type="text/javascript"
  
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</
script></div>
<{
$item.maintext}></div
<{if 
$pagenav}> 
    <
div class="smartsection_pagenav_bottom"><{$lang_page}>: <{$pagenav}></div
<{/if}> </
div
<{if 
$itemfooter}> 
  <
div class="smartsection_itemfooter"><{$itemfooter}></div
<{/if}> 
  <
div class="pre_itemInfo"
    <
div class="itemInfo" style="height: 14px;"> <{if $display_comment_link && $item.cancomment}> <span style="float: left;"><a href="<{$xoops_url}>/modules/smartsection/item.php?itemid=<{$item.itemid}>"><{$item.comments}> <{$lang_comments}></a></span> <{else}> <span style="float: left;">&nbsp;</span> <{/if}> <span style="float: right; text-align: right;"><{$item.adminlink}></span
      <
div style="height: 0; display: inline; clear: both;"></div
    </
div
  </
div
</
div>
<
br /> 
<{if 
$item.files}> 
<
table border="0" width="90%" cellspacing="1" cellpadding="0" align="center" class = "outer"
  <
tr
    <
td colspan="4" class="itemHead"><b><{$lang_files_linked}></b></td
  </
tr
  <
tr class="even"
    <
td align="left" width="45%" class="itemTitle"><b><{$lang_file_name}></b></td
    <
td align="center" class="itemTitle"><b><{$lang_file_type}></b></td
    <
td align="center" width="150px" class="itemTitle"><b><{$lang_datesub}></b></td
    <
td align="center" width="50px" class="itemTitle"><b><{$lang_hits}></b></td
  </
tr
  <!-- 
BEGIN DYNAMIC BLOCK --> 
<{foreach 
item=file from=$item.files}> 
  <
tr
    <
td valign="middle" class="odd" align="left"> <a href="visit.php?fileid=<{$file.fileid}>" target="_blank"><img src="<{$smartsection_url}>images/icon/file.gif" title="<{$lang_download_file}>" alt="<{$lang_download_file}>"/>&nbsp;<b><{$file.name}></b></a
      <
div><{$file.description}></div 
    <
td valign="middle" class="odd" align="center"><{$file.type}></td
    <
td valign="middle" class="odd" align="center"><{$file.datesub}></td
    <
td valign="middle" class="odd" align="center"><{$file.hits}></td
  </
tr
<{/foreach}> 
  <!-- 
END DYNAMIC BLOCK --> 
</
table>
<
br /> 
<{/if}> 
<!--
next line is to include smarttie --> 
<{if 
$smarttie==1}> <{include file='db:smarttie_links.html'}> <{/if}> 
<!--
end smarttie --> 
<{if 
$other_items == "previous_next"}> <{if $previous_item_link || $next_item_link}> 
<
table class="outer"
  <
tr
    <
td class="itemHead" colspan="2"><b><{$lang_items_links}></b></td
  </
tr
  <
tr style="vertical-align: middle;"
    <
td class="odd" width="50%" align="left"> <{if $previous_item_link}> <a href="<{$previous_item_url}>"><img style="vertical-align: middle;" src="<{$smartsection_images_url}>links/previous.gif" title="<{$lang_previous_item}>" alt="<{$lang_previous_item}>"/></a> <{$previous_item_link}> <{/if}> </td
    <
td class="odd" width="50%" align="right"> <{if $next_item_link}> <{$next_item_link}> <a href="<{$next_item_url}>"><img style="vertical-align: middle;" src="<{$smartsection_images_url}>links/next.gif" title="<{$lang_next_item}>" alt="<{$lang_next_item}>"/></a> <{/if}> </td
  </
tr
</
table>
<{/if}> <{elseif 
$other_items == 'all'}> 
<
table border="0" width="90%" cellspacing="1" cellpadding="3" align="center" class= "outer"
  <
tr
    <
td align="left" class="itemHead" width='65%'><b><{$lang_item}></b></td
<{if 
$display_date_col == 1}> 
    <
td align="center" class="itemHead" width="25%"><b><{$lang_datesub}></b></td
<{/if}> <{if 
$display_hits_col == 1}> 
    <
td align="center" class="itemHead" width="10%"><b><{$lang_hits}></b></td
<{/if}> </
tr
  <!-- 
Start item loop --> 
<{foreach 
item=item from=$items}> 
  <
tr valign="top"
    <
td class="even" align="left"><{$item.titlelink}></b></td
<{if 
$display_date_col == 1}> 
    <
td class="odd" align="left"><div align="center" valign="middle"><{$item.datesub}></div></td
<{/if}> <{if 
$display_hits_col == 1}> 
    <
td class="odd" align="left"><div align="center"><{$item.counter}></div></td
<{/if}> </
tr
<{/foreach}> 
  <!-- 
End item loop --> 
</
table>
<{/if}> <{if 
$isAdmin == 1}> 
<
div class="smartsection_adminlinks"><{$smartsection_adminpage}></div>
<{/if}> <{if (
$commentatarticlelevel && $item.cancomment) || $com_rule <> 0}> 
<
table border="0" width="100%" cellspacing="1" cellpadding="0" align="center" 
  <
tr
    <
td colspan="3" align ="left"> <div style="text-align: center; padding: 3px;
        margin:3px;"
> <{$commentsnav}> <{$lang_notice}></div
      <
div style="margin:3px; padding: 3px;"
        <!-- 
start comments loop --> 
<{if 
$comment_mode == "flat"}> <{include file="db:system_comments_flat.html"}> <{elseif $comment_mode == "thread"}> <{include file="db:system_comments_thread.html"}> <{elseif $comment_mode == "nest"}> <{include file="db:system_comments_nest.html"}> <{/if}> 
        <!-- 
end comments loop --> 
      </
div></td
  </
tr
</
table>
<{/if}> <{include 
file='db:system_notification_select.html'}>


In my style.css, I define the following class to make the text wrap around the Google ad.

.gads {
    
margin0 0 0 4px;
    
floatright;
}


Keep in mind that Google only allows 3 ad blocks per page. If you go over that limit, none or only some of your ads will display. Also, until Google spiders your site, you will most likely get a blank space where the ad should 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.

Login

Who's Online

193 user(s) are online (119 user(s) are browsing Support Forums)


Members: 0


Guests: 193


more...

Donat-O-Meter

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

Latest GitHub Commits