1

Topic: google customisation

Hi,

I'm really sorry to ask this question. I saw a few days/weeks ago Rickard explaining how he customisez the google ads. But I don't refind it.
Can you tell me where the post is.
Event with a search I do not got what I'm lookin for.

Ludo,

Re: google customisation

Rickard wrote:

I've gotten two e-mails asking me how I "integrated" the ads into the forums, so here's how:

1. I added the following to main.tpl below the footer:

<pun_include _google.php>

2. I then created a new PHP script called _google.php (the underscore is just there so I don't include it in a release by mistake or something stupid like that). The script contains this code:

<?php

switch ($pun_user['style'])
{
    case 'Cobalt':
        $bg_color = '2A2A2A';
        $link_color = '60A0DC';
        $text_color = 'D4D4D4';
        break;

    case 'Mercury':
        $bg_color = '2A2A2A';
        $link_color = 'F6B620';
        $text_color = 'D4D4D4';
        break;

    case 'Radium':
        $bg_color = '2A2A2A';
        $link_color = '60C860';
        $text_color = 'D4D4D4';
        break;

    case 'Sulfur':
        $bg_color = 'FFFFFF';
        $link_color = '822100';
        $text_color = '333333';
        break;

    case 'Lithium':
        $bg_color = 'FFFFFF';
        $link_color = '638137';
        $text_color = '333333';
        break;

    default:
        $bg_color = 'FFFFFF';
        $link_color = '005CB1';
        $text_color = '333333';
        break;
}

?>
<div style="TEXT-ALIGN: center">
    <script type="text/javascript">
    <!--
        google_ad_client = "pub-5038618221283072";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_channel ="";
        google_ad_type = "text";
        google_color_border = "<?php echo $bg_color ?>";
        google_color_bg = "<?php echo $bg_color ?>";
        google_color_link = "<?php echo $link_color ?>";
        google_color_url = "<?php echo $link_color ?>";
        google_color_text = "<?php echo $text_color ?>";
        google_alternate_color = "<?php echo $bg_color ?>";
    //-->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>

Not very pretty, but it works smile

3 (edited by Ludo 2005-03-02 13:42)

Re: google customisation

Huuum,

I put that in main.tpl:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html 

dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" 

/>
<pun_head>
</head>
<body>

<div id="punwrap">
<div id="pun<pun_page>" class="pun">

<div id="brdheader" 

class="block">
    <div class="box">
        <div id="brdtitle" class="inbox">
            <pun_title>
        

    <pun_desc>
        </div>
        <pun_navlinks>
        <pun_status>
    </div>
</div>

<pun_announcement>

<pun_main>

<pun_include _google.php><pun_footer>

</div>
</div>

</body>
</html>

and this is my _google.php file:

<?php

switch ($pun_user['style'])
{
    case 'Cobalt':
        $bg_color = '2A2A2A';
        $link_color = '60A0DC';
        $text_color = 'D4D4D4';
        break;

    case 'Mercury':
        $bg_color = '2A2A2A';
        $link_color = 'F6B620';
        $text_color = 'D4D4D4';
        break;

    case 'Radium':
        $bg_color = '2A2A2A';
        $link_color = '60C860';
        $text_color = 'D4D4D4';
        break;

    case 'Sulfur':
        $bg_color = 'FFFFFF';
        $link_color = '822100';
        $text_color = '333333';
        break;

    case 'Lithium':
        $bg_color = 'FFFFFF';
        $link_color = '638137';
        $text_color = '333333';
        break;

    case 'Oxygen':
        $bg_color = 'FFFFFF';
        $link_color = '005CB1';
        $text_color = '333333';
        break;
    
    default:
        $bg_color = '383838';
        $link_color = '426b94';
        $text_color = 'FFFFFF';
        break;
}

?>
<div style="TEXT-ALIGN: center">
    <script type="text/javascript">
    <!--
        google_ad_client = "pub-2756180042206854";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_channel ="";
        google_ad_type = "text_image";
        google_color_border = "<?php echo $bg_color ?>";
        google_color_bg = "<?php echo $bg_color ?>";
        google_color_link = "<?php echo $link_color ?>";
        google_color_url = "<?php echo $link_color ?>";
        google_color_text = "<?php echo $text_color ?>";
        google_alternate_color = "<?php echo $bg_color ?>";
    //-->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>

but it has no effect

Re: google customisation

BELOW the footer

5

Re: google customisation

I do not want it below the footer. I want it before the footer.

Re: google customisation

My mistake. You should put quotes around the filename. E.g.

<pun_include "_google.php">

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: google customisation

works good now.

Thanks,

Ludo,

Re: google customisation

How do you make it appear in a colored box (like an announcement)?

Re: google customisation

What is the path structure on the includes? The "tpl" files are in a folder of their own, so I'd like to know how I should include a file that's in a folder far away from the "includes/templates" folder, in fact out of the entire "punbb" directory? In your example "_google.php" is in the same folder as the tpl files?

Re: google customisation

craigm: If you're running 1.2.6 and you're going to include it from the template (using pun_include), the include file must be located in include/user (see the docs).

"Programming is like sex: one mistake and you have to support it for the rest of your life."