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: How can I include a file like anycontent on every page EXCEPT a certain album?  (Read 4178 times)

0 Members and 1 Guest are viewing this topic.

silly_walk

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 14

Hi,

I'd like to use one file to display my Adsense ads, but I'd also like to exclude 1 album. If I remove the
Code: [Select]
             if ($cat == 0)from
Code: [Select]
            case 'anycontent':
                if ($cat == 0) {
                    include('anycontent.php');
                }
                flush();
                break;
I can make anycontent appear on any index.php page, but as soon as I navigate to a thumbnail.php page, I lose the content. Can someone tell me what code to include in which files to allow the file to NOT display in only a certain album?

Thanks in advance.
« Last Edit: February 23, 2006, 02:44:30 am by Nibbler »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

Instead of using anycontent.php, you should use the custom header or custom footer feature that was introduced in cpg1.4.x (see docs). Add a switch like
Code: [Select]
if ($album != 'id_of_the_album_that_isn't_meant_to_show_ads') {
    print 'Your adsense code here';
}
in the custom header include file.
Logged

silly_walk

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 14

I created a new file named ad.php to use as a custom header, and used your exact code (substituting the album # for '2'). There is no other code in the file, but the displayed result only prints the code you gave me (above and below or on either side of the ad), while properly displaying the ad.

Unless I'm misunderstanding you...? You can see the result http://sillywalker.com/testcopp/index.php

Logged

Nibbler

  • Guest

Make sure you put the code inside php tags

Code: [Select]
<?php

code here

?>

Logged

silly_walk

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 14

OK, so I placed the following code in the ad.php file, and used the {CUSTOM_HEADER} to call it in the config:
Code: [Select]
<?php
if ($album != '2') {
    print 
'ad_code_here';
}
?>
This got rid of the code actually printing (thanks, Nibbler). But if I navigate to the album I want the ads to NOT appear on, they appear anyway.

What am I doing wrong?
Logged

silly_walk

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 14

Help?
Logged

Nibbler

  • Guest

Change $album to $_GET['album']
Logged

silly_walk

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 14

Change $album to $_GET['album']
Worked perfectly, thanks loads! :)
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.