Adsense in 1.4.x Adsense in 1.4.x
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Adsense in 1.4.x

Started by lordprodigy, February 16, 2006, 05:28:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lordprodigy

Aparently Google doesnt like (I had no idea) their ads on login and register screens, so I am wondering if this thread (http://forum.coppermine-gallery.net/index.php?topic=18284.0) for 1.3.2 works with 1.4.x. If it does, it is a really good way of handling ads.

lordprodigy

I followed exactly what was said in the above thread but the ads didnt show up and instead i get the {AD}  on the page.... I dont know where the problem is. Has anyone tried the above thread mod in 1.4.x?

thanks in advance!

Nibbler

Make sure you put the {AD} before the {GALLERY} tag, make it a custom footer otherwise.

lordprodigy

#3
right ON.. that was the problem. its working now. thanks.  ;)

I had to update the old code (menu section) to meet 1.4.x standard. Here is what I used. Its working. Is it correct?

// Function for page header and Google Ads
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        '{AD}' => generate_ad_block()       
);

    echo template_eval($template_header, $template_vars);
}

function generate_ad_block()
{
if (!defined('REGISTER_PHP') && !defined('LOGIN_PHP')){
$ad = <<< EOT
your google ad code goes here
EOT;

} else $ad = '';

return $ad;
}


mark this solved and compatible with 1.4.x