1
tgotch
Newbb and Adsense Code
  • 2005/12/3 18:55

  • tgotch

  • Just popping in

  • Posts: 66

  • Since: 2005/1/31


I have seen a few forums where people are putting adsense code between thread posts in their forum. Does anyone know how/where to implement the code in Newbb to do something like this?

Regards.

2
dickinsd
Re: Newbb and Adsense Code
  • 2005/12/3 19:09

  • dickinsd

  • Quite a regular

  • Posts: 278

  • Since: 2004/11/14


You would make this change in the thread template.

You need to clone your default template before you can make changes to it.

Assuming you have a cloned template set go to the template manager and look for forum or whatever you have called the forum module on your site.
Click on the link that says List and then look for a template called newbb_thread.html and click edit.

Originally it will look something like this (I am using Newbb2)

Quote:
<!-- start comment post -->
<a id="forumpost<{$topic_post.post_id}>"></a>
<table class="outer" cellpadding="0" cellspacing="0" border="0" width="100%" align="center" style="border-bottom-width: 0px;">
<tr>
<th width="20%"> <div align="center">
<ul class="newbb_level1">
<li class="newbb_folder">
<div class="newbb_submenu"><strong><{$down}>&nbsp;<{$topic_post.poster_name}></strong></div>
<ul class="newbb_level2">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<th><{$personal}><{$topic_post.poster_name}></th>
</tr>
<{$topic_post.poster_userbar}>
<{if $viewer_is_admin == true and $topic_post.poster_ip}>
<tr>
<th><{$smarty.const._MD_TOPICOPTIONADMIN}></th>
</tr>
<tr>
<td class="head"><strong>IP: <{$topic_post.poster_ip}></strong> </td>
</tr>
<{/if}>
</table>
</ul>
</li>
</ul>
</div></th>

<th width="80%" align="left"><div class="comTitle"><{$topic_post.post_title}></div></th><th align="right"><div class="comTitle" align="right">#<{$topic_post.post_no}></div></th>
</tr>

<tr>
<td width="20%" class="odd" rowspan="2" valign="top">
<{if $topic_post.poster_uid != 0}>
<div class="comUserRankText"><{$topic_post.poster_rank_title}><br /><{$topic_post.poster_rank_image}></div>
<img class="comUserImg" src="<{$xoops_upload_url}>/<{$topic_post.poster_avatar}>" alt="" />
<div class="comUserStat"><span class="comUserStatCaption"><{$smarty.const._MD_JOINED}>:</span> <{$topic_post.poster_regdate}></div>
<div class="comUserStat"><span class="comUserStatCaption"><{$smarty.const._MD_FROM}></span> <{$topic_post.poster_from}></div>
<div class="comUserStat"><span class="comUserStatCaption"><{$smarty.const._MD_POSTS}>:</span> <{$topic_post.poster_postnum}></div>
<{if $groupbar_enable}>
<div class="comUserStat"> <span class="comUserStatCaption"><{$smarty.const._MD_GROUP}></span> <br /><{$topic_post.poster_groups}> </div>
<{/if}>
<div class="comUserStatus"><{$topic_post.poster_status}></div>
<{else}>
<div class="comUserRankText"><{$anonymous_prefix}><{$topic_post.poster_uname}></div>
<{/if}>
</td>

<td colspan="2" class="odd">
<div class="comText"><{$topic_post.post_text}>HERE</div>
<{if $topic_post.post_attachment}>
<div class="comText"><{$topic_post.post_attachment}></div>
<{/if}>
<{if $topic_post.post_edit}>
<p align="right"><small><{$topic_post.post_edit}></small></p>
<{/if}>
</td>
</tr>

<tr>
<td colspan="2" class="odd" valign="bottom">
<{if $topic_post.poster_sig}>
<div class="signature">
_________________<br />
<{$topic_post.poster_sig}>
</div>
<{/if}>
</td>
</tr>


<tr>
<td width="20%" class="foot"><div class="comDate"><span class="comDateCaption"><{$smarty.const._MD_POSTEDON}></span><{$topic_post.post_date}></div>
<{foreach item=abtn from=$topic_post.thread_action}> <a href="<{$abtn.link}>&post_id=<{$topic_post.post_id}>" target="_blank" title="<{$abtn.name}>"> <{$abtn.image}></a> <{/foreach}>
</td>
<td colspan="2" class="foot"><div align="left"><a href="#threadtop" title="<{$smarty.const._MD_UP}>"><{$p_up}></a></div>
<div align="right" width="80%"><{foreach item=btn from=$topic_post.thread_buttons}> <a href="<{$btn.link}>&post_id=<{$topic_post.post_id}>" title="<{$btn.name}>"> <{$btn.image}></a> <{/foreach}></div>
</td>
</tr>
</table>
<!-- end comment post -->

You should see about half way down the code above I wrote HERE This is where you would add your Adsense code.

However I think that I remember seeing that you should have no more than 3 instances of adsense on a single page AND of course too many adds will distract from the content of the forums so you may want to add something like this:

<{if $topic_post.post_no == 1}><center><BR>[b]GOOGLE CODE HERE[/b]</center><BR><{/if}>


I think there may be a FAQ giving this info on this site somewhere you may want to try doing a search for more information.

Dave

Edit:FAQ for adding Adsense code to Newbb or Cbb

3
tgotch
Re: Newbb and Adsense Code
  • 2005/12/3 19:24

  • tgotch

  • Just popping in

  • Posts: 66

  • Since: 2005/1/31


Dave,
Thanks, that did it. I implemented the code as you said. It only shows one instance of adsense in the first post of the thread. Not sure what this does:

<{if $topic_post.post_no == 1}><center><BR>GOOGLE CODE HERE</center><BR><{/if}>


Anyway, thanks again!

4
gawel
Re: Newbb and Adsense Code
  • 2007/1/10 11:27

  • gawel

  • Just popping in

  • Posts: 28

  • Since: 2004/2/2 2


Could you tell me wwhta does it mean "$topic_post.post_no == 1"
This is number of the post in thread? If I put 3 or 4 it will display adsense in 3rd or 4th post?
It does not work on my site. I use NewBB 1.0.

Login

Who's Online

233 user(s) are online (161 user(s) are browsing Support Forums)


Members: 0


Guests: 233


more...

Donat-O-Meter

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

Latest GitHub Commits