Im trying to put adds on my site with a php include ,but it's not having it could somebody tell me whats wrong I have been trying for hours. Thanks -------------------------------------------------------------------------------------- <link href="css/auto.css" rel="stylesheet" type="text/css"> <meta name="viewport" content="width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> </head> <body> <div id="wrapper"> <div id="header-logo"><span class="header-text"> <h1>Tips to Avoid Disappointment </h1> </span> </div> <br><center> <p> <center> <?PHP include "ad.php";?> <br><center> <p> <center>
Hi thanks for the reply ,its still not working ,I have this in my ad.php file is this correct? <?php <script type="text/javascript"><!-- google_ad_client = "xxxxxxxxxxxxxxxxxxx"; /* app */ google_ad_slot = "xxxxxxxxxxxxxxxxxxxxxx"; google_ad_width = 300; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>'; ?>
use like this <?php include("ad.php"); ?> and be sure ad.php and the file where you are placing this code are on same folder.
Remove the PHP tags from your ad.php file so its just the adsense code inside the script tags. Then include the file with: <?php include("ad.php"); ?> Code (markup): Thats assuming the ad.php is in the same directory as the page you want the ads to display on.
Rename 1.html to 1.php Or add this line to your .htaccess AddType application/x-httpd-php .html Code (markup):
No, it isn't... do we SEE a problem here? <?php <script type="text/javascript"><!-- Code (markup): You put markup and scripting inside PHP tags. Javascript and markup doesn't go there! Lose the <?php at the start and ?> at the end, and the file will be sent client side. What you're doing now is trying to run client side javascript as server-side PHP... which is likely throwing some sort of PHP error I'd hope. I'm a little surprised nobody else noticed this -- but again it's another of the reasons I'm in favor of having <?php ?> stricken from PHP entirely. NOT that the markup isn't bad either width the DIV and span around the H1 likely for no good reason, and the presence fo the CENTER tag that has no business in any HTML written after 1998. Much less opening it more than once without closing it which makes even less sense... -- edit -- oops, my bad, t0asty noticed it, but didn't elaborate very well... Guess my TSDR kicked in again. (too short, didn't read)