I've got a bunch of html files and want adsense in all those. So i read up some material online and did the following things - made an adsense.php that just has the adsense code in it - put the following line in the html at the point where i want the ads <?php include("adsense.php") ?> But the ads just don't show up. The html and php files are in the same folder and my host does have php installed coz i can run wordpress on it. Help please!
you normally can't run php codes in html such <?php include("adsense.php") ?> PHP: for doing this, the shortest way I know is creating a .htaccess file, paste this code in it and upload it your ftp's public dir. here is the code: RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html Code (markup): Regards.
You can not run that in .htm or .html (only .php) files natively, so that code makes .html files on your server/directory identify as .php files.
To sum things up, you can only run a PHP script such as the one you used to include adsense.php on a file with .php as extension.
using this code your all .htm and .html files are being parsed as PHP scripts. that means, if your .htm or .html files include some PHP codes in there, these codes will be worked properly as PHP codes. However, using this method has a bit performance loss. I mean parsing PHP files which include just PHP codes is faster than parsing HTML files which include PHP codes between HTML codes.. Regards.