Add Google AdSense inside Kunena Forum for Joomla PDF Print E-mail

google_adsense_thumb You can easily add Google Ads embedded in the forum listing with Kunena Forum 1.0.8. Follow the steps in this simple tutorial.

  1. Go to the Administrator and select the menu Components > Kunena Forum

  2. Click on Kunena Configuration

  3. Scroll down to the Frontent parameters and locate the Template setting

    kunena_config_template

  4. Locate the view.php file in the Kunena installation:

    {$JOOMLA}/components/com_kunena/template/{TEMPLATE_NAME}/view.php

    where

    {$JOOMLA} is the Joomla installation folder
    {TEMPLATE_NAME} is the name of the template that you are using

  5. Make a backup copy of the view.php file.

  6. Go to Google AdSense and get desired ad code.

  7. Open view.php in your favorite text editor. Locate the following lines, around line 1195:

      1 
      2 
      3 

      4 

      5 
      6 
      7 

      8 
      9 
     10 
     11 
     12 
     13 
     14 
     15 
     16 
    <?php
                                    
    //(JJ)
                                    
    if (file_exists(KUNENA_ABSTMPLTPATH 
                                      '/message.php'
    )) {
                                        include (
    KUNENA_ABSTMPLTPATH 
                                          '/message.php'
    );
                                    }
                                    else {
                                        include (
    KUNENA_ABSPATH 
                                          '/template/default/message.php'
    );
                                    }

                                    unset(
                                    
    $msg_id,
                                    
    $msg_username,
                                    
    $msg_avatar,
                                    
    $msg_usertype,
                                    
    $msg_userrank,
    ?>                                



  8. Add your Google AdSense code:

      1 
      2 
      3 

      4 

      5 
      6 
      7 

      8 
      9 
     10 
     11 
     12 

     13 
     14 
     15 
     16 
     17 
     18 
     19 
     20 
     21 
     22 

     23 
     24 
     25 
     26 
     27 
     28 
     29 
     30 
     31 
     32 
     33 
     34 
    <?php
                                    
    //(JJ)
                                    
    if (file_exists(KUNENA_ABSTMPLTPATH 
                                      '/message.php'
    )) {
                                        include (
    KUNENA_ABSTMPLTPATH 
                                          '/message.php'
    );
                                    }
                                    else {
                                        include (
    KUNENA_ABSPATH 
                                          '/template/default/message.php'
    );
                                    }

                    
    // Google AdSense ---> start
                    
    if ( $mmm == ) {
                        echo 
    '<div style="margin-top: 10px;margin-bottom: 10px;">' .
                          "\n"
    ;
                        echo 
    '<script type="text/javascript"><!--' "\n";
                        echo 
    'google_ad_client = "pub-1348872499180295";' "\n"
                        echo 
    "/* 728x90, created 3/17/09 */\n"
                        echo 
    'google_ad_slot = "7075580028";' "\n"
                        echo 
    "google_ad_width = 728;\n";
                        echo 
    "google_ad_height = 90;\n";
                        echo 
    "//-->\n";
                        echo 
    "</script>\n";
                        echo 
    '<script type="text/javascript"' "\n"
                        echo 
    'src="http://pagead2.googlesyndication.com/pagead/show_
                          ads.js">' 
    "\n"
                        echo 
    "</script>\n";
                        echo 
    "</div>\n";
                    }
                    
    // Google AdSense ---> end

                                    
    unset(
                                    
    $msg_id,
                                    
    $msg_username,
                                    
    $msg_avatar,
                                    
    $msg_usertype,
                                    
    $msg_userrank,
    ?>                                



  9. Done!


The forum at Joomla-R-Us is using this little hack. Here's a sample thread where you can see this in action.

Comments (3)add comment

Write comment

security image
Write the displayed characters


busy
 
 
  Design by augs-burg.de & go-vista.de  
 
     
 
   
 

The Joomla!(R) name is used under a limited license from Open Source Matters in the United States and other countries. http://Joomla-R-Us.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.