Google Adsense in Xoops Newbb without Code Repitition

Ever saw a xoops site with newbb module which contain a code at the first posting of every topic? Let’s assume that we dont want the code to be attached to every replies, but rather be attached to only the first replied in each post. Let’s work it out with a simple code hacking..

1. Open your “viewtopic.php” in folder modules/newbb/

2. Find this statement:
if ( $viewmode == “thread” ) {

3. There will be 2 loops involve, one for threaded view, one for flatten.

4. Look for this statement:
foreach ( $postsArray as $eachpost ) {

5. Change the statement to:

$adcount=0;
foreach ( $postsArray as $eachpost ) {
if ($adcount==0)
{
$ads=”

[your code here]
“;
}
else
{
$ads=”";
}

6. Then look for another statement like:

$post_text = $eachpost->text();

7. Change it to:

$post_text = $eachpost->text().$ads;

8. Look for another loop few linew below it and do the modification exactly the same.

9. Save the file and upload.

10. Be sure that you have backed up the original file somewhere : )

Posted December 6th, 2005 by mightyhitter under Uncategorized

 

4 Responses to “Google Adsense in Xoops Newbb without Code Repitition”

  1. vidal Says:

    aku ada try buat ni aku paste satu page ::

  2. vidal Says:

    tapi tak jadik la basri .. cuba double check balik sebab aku test pakai code yg sama dengan yg ko guna .. thanks

  3. income Says:

    Aku ada buat gaks basri…sama cam vidal tak jadi lerrr
    Basri tolong update yer….

  4. sike Says:

    This is another worthwhile article for incorperating adsense in xoops How to make the most with adsense and xoops based websites

Leave a Reply