[Solved]: Putting adsense code only in certain albums [Solved]: Putting adsense code only in certain albums
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Solved]: Putting adsense code only in certain albums

Started by pirizoe, August 09, 2008, 10:03:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pirizoe

I have different albums created and some of them I don't want the publicity of google.
I want to create that condition but I do not know where I can put this code, or what variables .... .
I would like the advertising appeared on page "thumbnails" and which pictured intermediate "displayimage."
The albums are different themes, landscapes, nature, portraits, erotic, etc. .... The problem comes in the theme of erotic, google does not accept advertising content nude.

Thanks

copperminepro

#1
You could do something like this:

Find in theme.php:

  if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }


Replace with:

if (($aid != '12') || ($aid != '11') || ($aid != '10') ) {
      $byalbumad = '<tr><td>your ad code here</td></tr>';
      } else {
      $byalbumad = ''; }
     
    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html,
            '{BYALBUMAD}' => $byalbumad
            );
        echo template_eval($tabs, $params);
    }


Find in themes.php:
<tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
               
                 

                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>


                                       {TABS}


Before, Add:
{BYALBUMAD}

12, 11, and 10 are the album id' in which you don't want to have the ad displayed in. You can adapt this for the viewimage page to prevent ads from appear there also.

pirizoe

Very good
I had to change a little theme.php.
I works perfectly

Thank you  :)

copperminepro

i just noticed, in the first "replace" i had:
if ($aid != '13') {
That's useless and was a typo, hopefully you noticed :-(

Nibbler

if (($aid != '12') || ($aid != '11') || ($aid != '10') ) {

This will always evaluate to true. You should use AND not OR or more neatly, an array of numbers to check.

pirizoe

#5
It works well with this code:

In theme.php:

if (($aid == '11') || ($aid == 'topn')){
      $byalbumad = 'no adsense';
        }
 
      else {
      $byalbumad = '<div align="center">adsense<div>'; }

if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html,
            '{BYALBUMAD}' => $byalbumad
            );
        echo template_eval($tabs, $params);
    }


In themes.inc.php:

<tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {BYALBUMAD}
                                </tr>
<tr>
{TABS}
</tr>
                        </table>
                </td>
        </tr>
{BYALBUMAD}


But can't do the same for intermediate image display

http://letocar.com/

Joachim Müller

Don't edit include/themes.inc.php! Edit themes/yourtheme/theme.php instead, and only that file.