Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Solved]: Putting adsense code only in certain albums  (Read 3612 times)

0 Members and 1 Guest are viewing this topic.

pirizoe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
[Solved]: Putting adsense code only in certain albums
« on: August 09, 2008, 10:03:15 pm »

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
« Last Edit: August 10, 2008, 06:24:46 pm by Nibbler »
Logged

copperminepro

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
Re: Putting adsense code only in certain albums
« Reply #1 on: August 09, 2008, 11:42:31 pm »

You could do something like this:

Find in theme.php:
Code: [Select]
  if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }

Replace with:
Code: [Select]
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:
Code: [Select]
<tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
               
                 

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


                                       {TABS}

Before, Add:
Code: [Select]
{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.
« Last Edit: August 11, 2008, 01:21:47 am by copperminepro »
Logged

pirizoe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Putting adsense code only in certain albums
« Reply #2 on: August 10, 2008, 06:13:45 pm »

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

Thank you  :)
Logged

copperminepro

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
Re: [Solved]: Putting adsense code only in certain albums
« Reply #3 on: August 11, 2008, 01:22:45 am »

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

Nibbler

  • Guest
Re: [Solved]: Putting adsense code only in certain albums
« Reply #4 on: August 11, 2008, 02:17:17 pm »

Code: [Select]
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.
Logged

pirizoe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: [Solved]: Putting adsense code only in certain albums
« Reply #5 on: August 11, 2008, 03:14:24 pm »

It works well with this code:

In theme.php:

Code: [Select]
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:

Code: [Select]
<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/
« Last Edit: August 11, 2008, 06:54:09 pm by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Putting adsense code only in certain albums
« Reply #6 on: August 11, 2008, 06:54:50 pm »

Don't edit include/themes.inc.php! Edit themes/yourtheme/theme.php instead, and only that file.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 16 queries.