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: Different Template for login and register pages. Possible?  (Read 4177 times)

0 Members and 1 Guest are viewing this topic.

ChaosCrusader

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Finalf Frontier - The Ultimate Free Space Wallpapers

Hi guys.  I'm currently using Adsense to generate revenue on a Coppermine based site.  The problem is that the adsense code is added in the template.html file, and thus shows up on all the pages including the register and login pages, which isn't allowed by Google.  Is there a way to perhaps use a different template for those files only or in some way remove the adsense code/stop it from showing on the login.php and register.php files?

I have no knowledge of PHP or Javascript so any help would be MUCH appreciated.  I'm totally clueless on how to accomplish this.   ???

PS.  Using Coppermine 1.3.3
« Last Edit: May 28, 2005, 02:20:04 pm by Nibbler »
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Different Template for login and register pages. Possible?
« Reply #1 on: May 27, 2005, 05:20:17 am »

If the code is just a long string, it wouldn't have to go in your template file.  It could easily be parsed in the theme.php file and dropped into a token (like the {GALLERY} token in template.html) only if login.php and register.php aren't calling the template.

What's the code?
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

ChaosCrusader

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Finalf Frontier - The Ultimate Free Space Wallpapers
Re: Different Template for login and register pages. Possible?
« Reply #2 on: May 27, 2005, 06:30:49 am »

The code is a Javascript:

Code: [Select]
<center><br>             
            <script type="text/javascript"><!--
google_ad_client = "xxxxx";
google_alternate_ad_url = "xxxxl";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "5B5B5B";
google_color_bg = "5B5B5B";
google_color_link = "ffffff";
google_color_url = "ffffff";
google_color_text = "ffffff";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>

Nibbler

  • Guest
Re: Different Template for login and register pages. Possible?
« Reply #3 on: May 27, 2005, 06:48:01 pm »

In your theme's theme.php, find the pageheader function and replace it with these 2 functions

Code: [Select]
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
'{AD}' => generate_ad_block()
        );

    echo template_eval($template_header, $template_vars);
}

function generate_ad_block()
{
if (!defined('REGISTER_PHP') && !defined('LOGIN_PHP')){
$ad = <<< EOT

<center><br>             
            <script type="text/javascript"><!--
google_ad_client = "xxxxx";
google_alternate_ad_url = "xxxxl";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "5B5B5B";
google_color_bg = "5B5B5B";
google_color_link = "ffffff";
google_color_url = "ffffff";
google_color_text = "ffffff";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
EOT;

} else $ad = '';

return $ad;
}

than add {AD} into your template.html where you want the ad to appear.
Logged

ChaosCrusader

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Finalf Frontier - The Ultimate Free Space Wallpapers
Re: Different Template for login and register pages. Possible?
« Reply #4 on: May 27, 2005, 07:40:34 pm »

Thanks a million!  That did the trick perfectly.  Just a question, if I want to do the same for another ad, can I just modify the code as follows for the second ad?

Code: [Select]
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
'{AD}' => generate_ad_block(),
'{AD2}' => generate_ad_block2()
        );

    echo template_eval($template_header, $template_vars);
}

function generate_ad_block()
{
if (!defined('REGISTER_PHP') && !defined('LOGIN_PHP')){
$ad = <<< EOT

<center><br>             
            <script type="text/javascript"><!--
google_ad_client = "xxxxx";
google_alternate_ad_url = "xxxxl";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "5B5B5B";
google_color_bg = "5B5B5B";
google_color_link = "ffffff";
google_color_url = "ffffff";
google_color_text = "ffffff";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
EOT;

} else $ad = '';

return $ad;
}

function generate_ad_block2()
{
if (!defined('REGISTER_PHP') && !defined('LOGIN_PHP')){
$ad = <<< EOT

<center><br>             
            <script type="text/javascript"><!--
code_ for_other_ad;
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
EOT;

} else $ad = '';

return $ad;
}



kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Different Template for login and register pages. Possible?
« Reply #5 on: May 27, 2005, 07:43:31 pm »

Yes.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

ChaosCrusader

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Finalf Frontier - The Ultimate Free Space Wallpapers
Re: Different Template for login and register pages. Possible?
« Reply #6 on: May 28, 2005, 02:12:35 pm »

Ok.  Thanks again.  Excellent support for an excellent product!
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 21 queries.