forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: lordprodigy on February 16, 2006, 05:28:02 am

Title: Adsense in 1.4.x
Post by: lordprodigy on February 16, 2006, 05:28:02 am
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.
Title: Re: Adsense in 1.4.x
Post by: lordprodigy on February 17, 2006, 05:42:22 pm
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!
Title: Re: Adsense in 1.4.x
Post by: Nibbler on February 17, 2006, 05:53:43 pm
Make sure you put the {AD} before the {GALLERY} tag, make it a custom footer otherwise.
Title: Re: Adsense in 1.4.x
Post by: lordprodigy on February 17, 2006, 06:24:58 pm
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?

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