How can I include a file like anycontent on every page EXCEPT a certain album? How can I include a file like anycontent on every page EXCEPT a certain album?
 

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

How can I include a file like anycontent on every page EXCEPT a certain album?

Started by silly_walk, February 14, 2006, 07:57:16 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

silly_walk

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
             if ($cat == 0)
from
            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.

Joachim Müller

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 if ($album != 'id_of_the_album_that_isn't_meant_to_show_ads') {
    print 'Your adsense code here';
}
in the custom header include file.

silly_walk

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


Nibbler


silly_walk

OK, so I placed the following code in the ad.php file, and used the {CUSTOM_HEADER} to call it in the config:
<?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?



silly_walk