coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: pirizoe on August 09, 2008, 10:03:15 PM

Title: [Solved]: Putting adsense code only in certain albums
Post by: pirizoe 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
Title: Re: Putting adsense code only in certain albums
Post by: copperminepro on August 09, 2008, 11:42:31 PM
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.
Title: Re: Putting adsense code only in certain albums
Post by: pirizoe on August 10, 2008, 06:13:45 PM
Very good
I had to change a little theme.php.
I works perfectly

Thank you  :)
Title: Re: [Solved]: Putting adsense code only in certain albums
Post by: copperminepro on August 11, 2008, 01:22:45 AM
i just noticed, in the first "replace" i had:
if ($aid != '13') {
That's useless and was a typo, hopefully you noticed :-(
Title: Re: [Solved]: Putting adsense code only in certain albums
Post by: Nibbler on August 11, 2008, 02:17:17 PM
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.
Title: Re: [Solved]: Putting adsense code only in certain albums
Post by: pirizoe on August 11, 2008, 03:14:24 PM
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/
Title: Re: [Solved]: Putting adsense code only in certain albums
Post by: Joachim Müller 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.