Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can Someone Help me add a Google Adsense Script into a PHP FIle?

    <?php
    include("lib/vars.inc.php");
    include("lib/db.inc.php");
    include("lib/kernel.inc.php");
    include("template/template.inc.php");
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $QUERY = $_POST;
    }
    else {
    $QUERY = $_GET;
    }

    extract($QUERY);

    make2mid();
    mysql_select_db($dbName);
    $query="SELECT img_links.part_id, img_links.link FROM img_links WHERE img_links.img_id=$img_id";
    $result=mysql_query($query);
    $row=mysql_fetch_array($result);
    $part_id=safestr($row['part_id']);
    $img_link=safestr($row['link']);
    $query="SELECT * FROM img_parts WHERE img_parts.part_id=$part_id";
    $result=mysql_query($query);
    $row=mysql_fetch_array($result);
    $name=$row['name'];
    $keywords=$row['keywords'];
    $title=$row['descr'];
    $TEMPLATE['KEYWORDS'] = $keywords ;
    $TEMPLATE['DESCRIPTION'] = $title.". ".$TEMPLATE['DESCRIPTION'];
    $part_link=safestr($row['part_link']);
    $TEMPLATE['DATA'] .= " <table width=100% border=0 cellspacing=2 cellpadding=0>
    <tr>
    <td width=300 height=225><img src=".$part_link."images/".$img_link." width=300 height=225 border=1 alt=\"".$name." wallpaper\"></td>
    <td rowspan=2 align=left valign=top>
    <p>
    <font color='#ff0000'><b>New!</b></font> <a href='http://download.freeze.com/lm/affiliate_downloads/samplewpaper_9767.exe'><b>Download a Free Wallpaper Pack!!!</b></a>
    </p>
    <b>How to use:<br>
    </b><br> Wait until the picture has finished loading!<br><br>
    <b>Windows Users (Windows 98/2000/XP):</b><br>Right click on the desktop picture and select 'Set as Background'
    or 'Set as Wallpaper'. If you want to save it to your hard
    disk just select 'Save image as...'
    <p><b>Mac Users (For MAC O/S 8.0 and higher):</b><br>
    Wait until the movie picture has finished loading, save the
    image to your hard disk and use the control panel to set the
    picture as your wallpaper. <br>
    </p>
    </td>


    Here is where I want to place the Google script but it's not working? It gives me a blank page when I post it to the site...

    <td width=50%>
    <script type="text/javascript"><!--
    google_ad_client = "';
    /* 300x250, created 5/7/09 */
    google_ad_slot = "";
    google_ad_width = 300;
    google_ad_height = 250;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>



    </td>

    </tr>
    <tr>
    <td width=300 align=left valign=top><img src=images/!.gif width=16 height=16 border=0><font color=#ff0000><b> This is reduced image, just follow 'How to use' instructions to set wallpaper.</b></font></td>
    </tr>
    </table><br><br><br><br>";
    makeaftermid();
    makePage($title);
    ?>

  • #2
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Code:
    google_ad_client = "';
    You are opening a double quote and closing a single quote there.

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help! That is sample google code... even when the google code is correct, it still makes the page a blank page? Any ideas on how to properly insert the Google Script there?

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You are not properly escaping the quotation marks with slashes.
    Last edited by denshao2; 05-13-2009 at 06:36 AM. Reason: misread the first time

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    People its important to note there is a option when you created the add to show nothing if there is no add to display. It may be that the code is fine you just have to give it a little time then it will show up. I got hit with this before so keep it in mind.

    I think the best way if your using the same add code over and over is just to make a php function to echo it for you. This really cleans up the look of the pages and avoids stupid typos. But bare in mind i am pretty new to this php stuff, so there might be some disadvantage to this I am unaware off.
    Last edited by geofftop; 05-16-2009 at 11:44 AM. Reason: spelling


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •