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: Adsense in 1.4.x  (Read 3269 times)

0 Members and 1 Guest are viewing this topic.

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Adsense in 1.4.x
« 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.
« Last Edit: February 17, 2006, 06:25:20 pm by Nibbler »
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Adsense in 1.4.x
« Reply #1 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!
Logged

Nibbler

  • Guest
Re: Adsense in 1.4.x
« Reply #2 on: February 17, 2006, 05:53:43 pm »

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

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Adsense in 1.4.x
« Reply #3 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
« Last Edit: February 17, 2006, 06:30:17 pm by lordprodigy »
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.